diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-10-18 17:46:48 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-06 10:21:01 -0600 |
commit | 4c5ff1d08ef5ddb7db432b864e18dd7674fbc116 (patch) | |
tree | 7592f65f9010b2bb7df16ba138ee5c56258a53f7 /config | |
parent | 57652bf58482dd1b4ac26b5f804d3d4ece6591d8 (diff) | |
download | gitlab-ce-4c5ff1d08ef5ddb7db432b864e18dd7674fbc116.tar.gz |
add webpack, webpack-rails, and webpack-dev-server along with a simple hello world test
Add the following line to GDK Procfile to play with it:
webpack: exec support/exec-cd gitlab npm run dev-server
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 5 | ||||
-rw-r--r-- | config/webpack.config.js | 46 |
2 files changed, 51 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb index d36c6d5c92e..02839dba1ed 100644 --- a/config/application.rb +++ b/config/application.rb @@ -80,6 +80,11 @@ module Gitlab # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql + # Configure webpack + config.webpack.config_file = "config/webpack.config.js" + config.webpack.output_dir = "public/assets/webpack" + config.webpack.public_path = "assets/webpack" + # Enable the asset pipeline config.assets.enabled = true config.assets.paths << Gemojione.images_path diff --git a/config/webpack.config.js b/config/webpack.config.js new file mode 100644 index 00000000000..ea51c9d1af7 --- /dev/null +++ b/config/webpack.config.js @@ -0,0 +1,46 @@ +'use strict'; + +var path = require('path'); +var webpack = require('webpack'); +var StatsPlugin = require('stats-webpack-plugin'); + +var IS_PRODUCTION = process.env.NODE_ENV === 'production'; +var ROOT_PATH = path.resolve(__dirname, '..'); + +// must match config.webpack.dev_server.port +var DEV_SERVER_PORT = 3808; + +var config = { + context: ROOT_PATH, + entry: { + bundle: './app/assets/javascripts/webpack/bundle.js' + }, + + output: { + path: path.join(ROOT_PATH, 'public/assets/webpack'), + publicPath: '/assets/webpack/', + filename: IS_PRODUCTION ? '[name]-[chunkhash].js' : '[name].js' + }, + + plugins: [ + // manifest filename must match config.webpack.manifest_filename + // webpack-rails only needs assetsByChunkName to function properly + new StatsPlugin('manifest.json', { + chunkModules: false, + source: false, + chunks: false, + modules: false, + assets: true + }) + ] +} + +if (!IS_PRODUCTION) { + config.devServer = { + port: DEV_SERVER_PORT, + headers: { 'Access-Control-Allow-Origin': '*' } + }; + config.output.publicPath = '//localhost:' + DEV_SERVER_PORT + config.output.publicPath; +} + +module.exports = config; |