diff --git a/.babelrc b/.babelrc index 4646081cfc2..2378e359c1d 100644 --- a/.babelrc +++ b/.babelrc @@ -1,8 +1,31 @@ { - "presets": ["env", "react"], + "presets": [ + [ + "env", + { + "modules": false, + "targets": { + "browsers": "> 1%", + "uglify": true + }, + "useBuiltIns": true + } + ], + "react" + ], "plugins": [ - "transform-class-properties", + "syntax-dynamic-import", "transform-object-rest-spread", - "transform-object-assign" - ] + [ + "transform-class-properties", + { + "spec": true + } + ] + ], + "env": { + "test": { + "presets": ["env", "react"] + } + } } diff --git a/.gitignore b/.gitignore index 44a72c4e04e..29cd516595a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ public/webpack package-lock.json npm-debug.log .vscode +/public/packs +/public/packs-test diff --git a/.postcssrc.yml b/.postcssrc.yml new file mode 100644 index 00000000000..a123d1fd22c --- /dev/null +++ b/.postcssrc.yml @@ -0,0 +1,3 @@ +plugins: + postcss-smart-import: {} + postcss-cssnext: {} diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js index 9e4c3221442..c3a6300378b 100644 --- a/.storybook/webpack.config.js +++ b/.storybook/webpack.config.js @@ -1,36 +1,5 @@ -let path = require('path'); +const webpackConfig = require('../config/webpack/development'); module.exports = { - module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules/, - loader: 'babel-loader', - options: { - presets: [ - path.join(__dirname, '..', 'node_modules/babel-preset-react'), - path.join(__dirname, '..', 'node_modules/babel-preset-env') - ], - plugins: [ - path.join(__dirname, '..', 'node_modules/babel-plugin-transform-class-properties'), - path.join(__dirname, '..', 'node_modules/babel-plugin-transform-object-rest-spread'), - path.join(__dirname, '..', 'node_modules/babel-plugin-transform-object-assign') - ] - } - }, - { - test: /\.css$/, - loaders: ['style-loader', 'css-loader'] - }, - { - test: /(\.png|\.gif)$/, - loader: 'url-loader?limit=32767' - }, - { - test: /\.scss$/, - loaders: ['style-loader', 'css-loader', 'sass-loader'] - } - ] - } + module: webpackConfig.module, }; diff --git a/Gemfile b/Gemfile index b66b0cdfdb0..ef6f9f002c0 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,7 @@ gem 'responders', '~> 2.0' gem 'roadie-rails', '~> 1.1' gem 'x-editable-rails', '~> 1.5.5' gem 'deacon', '~> 1.0' -gem 'webpack-rails', '~> 0.9.8' +gem 'webpacker', '~> 3.0' gem 'mail', '~> 2.7' gem 'sshkey', '~> 1.9' gem 'ruby2ruby', '2.3.2' diff --git a/Procfile b/Procfile index ee19cd65136..1f195b07ca7 100644 --- a/Procfile +++ b/Procfile @@ -1,5 +1,15 @@ # Run Rails & Webpack concurrently -# If you wish to use a different server then the default, use e.g. `export RAILS_STARTUP='puma -w 3 -p 3000 --preload'` +# If you wish to use a different server then the default, use e.g. +# `export RAILS_STARTUP='puma -w 3 -p 3000 --preload'` +# OR +# RAILS_STARTUP='puma -w 3 -p 3000 --preload' foreman start rails: [ -n "$RAILS_STARTUP" ] && env PRY_WARNING=1 $RAILS_STARTUP || [ -n "$BIND" ] && bin/rails server -b $BIND || env PRY_WARNING=1 bin/rails server -# you can use WEBPACK_OPTS to customize webpack server, e.g. 'WEBPACK_OPTS='--https --key /path/to/key --cert /path/to/cert.pem --cacert /path/to/cacert.pem' foreman start ' -webpack: ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js $WEBPACK_OPTS + +# you can use environment variables as options supported by webpack-dev-server +# in the form WEBPACKER_DEV_SERVER_