diff --git a/.babelrc b/.babelrc index d59afb2fb..163604ea9 100644 --- a/.babelrc +++ b/.babelrc @@ -1,20 +1,33 @@ { "presets": [ - "latest", "react", "stage-1" ], "env": { "development": { "presets": [ + "latest", "react-hmre" ] }, "production": { + "presets": [ + ["latest", { + "es2015": { + "modules": false + } + }], + ], "plugins": [ "transform-react-constant-elements", "transform-react-remove-prop-types" ] + }, + "test": { + "presets": [ + "latest" + ] } } } + diff --git a/.eslintrc b/.eslintrc index e5209d255..3cae0065f 100755 --- a/.eslintrc +++ b/.eslintrc @@ -53,6 +53,7 @@ "react/jsx-sort-props": 0, "react/jsx-uses-react": 1, "react/jsx-uses-vars": 1, + "react/jsx-wrap-multilines": 1, "react/no-danger": 1, "react/no-did-mount-set-state": 1, "react/no-did-update-set-state": 1, @@ -65,8 +66,7 @@ "react/react-in-jsx-scope": 1, "import/extensions": 1, "react/self-closing-comp": 1, - "react/sort-comp": 1, - "react/jsx-wrap-multilines": 1 + "react/sort-comp": 1 }, "globals": { } diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 675bbebff..515f8b911 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -10,5 +10,6 @@ react-slingshot contributors (sorted alphabetically) * Kohei TAKATA ([kohei-takata](https://github.com/kohei-takata)) * Kyle Welch ([kwelch](https://github.com/kwelch)) * Marco Bettiolo ([bettiolo](https://github.com/bettiolo)) +* Matt Wigdahl ([mlwigdahl](https://github.com/mlwigdahl)) * Nick Taylor ([nickytonline](https://github.com/nickytonline)) * ReadmeCritic ([readmecritic](https://github.com/readmecritic)) diff --git a/package.json b/package.json index 348578593..a56a16956 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "eslint-plugin-import": "2.2.0", "eslint-plugin-react": "6.8.0", "eslint-watch": "2.1.14", - "extract-text-webpack-plugin": "1.0.1", + "extract-text-webpack-plugin": "2.0.0-beta.4", "file-loader": "0.9.0", "html-webpack-plugin": "2.24.1", "identity-obj-proxy": "3.0.0", @@ -82,7 +82,7 @@ "sass-loader": "4.1.0", "style-loader": "0.13.1", "url-loader": "0.5.7", - "webpack": "1.14.0", + "webpack": "2.2.1", "webpack-bundle-analyzer": "2.1.1", "webpack-dev-middleware": "1.9.0", "webpack-hot-middleware": "2.13.2", diff --git a/webpack.config.dev.js b/webpack.config.dev.js index da4047aa6..43e9242bb 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -5,11 +5,9 @@ import path from 'path'; export default { resolve: { - extensions: ['', '.js', '.jsx', '.json'] + extensions: ['*', '.js', '.jsx', '.json'] }, - debug: true, devtool: 'eval-source-map', // more info:https://webpack.github.io/docs/build-performance.html#sourcemaps and https://webpack.github.io/docs/configuration.html#devtool - noInfo: true, // set to false to see a list of every file being bundled. entry: [ // must be first entry to properly set public path './src/webpack-public-path', @@ -28,7 +26,7 @@ export default { __DEV__: true }), new webpack.HotModuleReplacementPlugin(), - new webpack.NoErrorsPlugin(), + new webpack.NoEmitOnErrorsPlugin(), new HtmlWebpackPlugin({ // Create HTML file that includes references to bundled CSS and JS. template: 'src/index.ejs', minify: { @@ -36,20 +34,30 @@ export default { collapseWhitespace: true }, inject: true - }) + }), + new webpack.LoaderOptionsPlugin({ + minimize: false, + debug: true, + noInfo: true, // set to false to see a list of every file being bundled. + options: { + sassLoader: { + includePaths: [path.resolve(__dirname, 'src', 'scss')] + }, + context: '/', + postcss: () => [autoprefixer], + } + }) ], module: { - loaders: [ - {test: /\.jsx?$/, exclude: /node_modules/, loaders: ['babel']}, - {test: /\.eot(\?v=\d+.\d+.\d+)?$/, loader: 'file'}, - {test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&mimetype=application/font-woff'}, - {test: /\.[ot]tf(\?v=\d+.\d+.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream'}, - {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml'}, - {test: /\.(jpe?g|png|gif)$/i, loader: 'file?name=[name].[ext]'}, - {test: /\.ico$/, loader: 'file?name=[name].[ext]'}, - {test: /(\.css|\.scss)$/, loaders: ['style', 'css?sourceMap', 'postcss', 'sass?sourceMap']}, - {test: /\.json$/, loader: "json"} + rules: [ + {test: /\.jsx?$/, exclude: /node_modules/, loaders: ['babel-loader']}, + {test: /\.eot(\?v=\d+.\d+.\d+)?$/, loader: 'file-loader'}, + {test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'}, + {test: /\.[ot]tf(\?v=\d+.\d+.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'}, + {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'}, + {test: /\.(jpe?g|png|gif)$/i, loader: 'file-loader?name=[name].[ext]'}, + {test: /\.ico$/, loader: 'file-loader?name=[name].[ext]'}, + {test: /(\.css|\.scss)$/, loaders: ['style-loader', 'css-loader?sourceMap', 'postcss-loader', 'sass-loader?sourceMap']} ] - }, - postcss: ()=> [autoprefixer] + } }; diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 7753a2e8e..81251e839 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -14,11 +14,9 @@ const GLOBALS = { export default { resolve: { - extensions: ['', '.js', '.jsx', '.json'] + extensions: ['*', '.js', '.jsx', '.json'] }, - debug: true, devtool: 'source-map', // more info:https://webpack.github.io/docs/build-performance.html#sourcemaps and https://webpack.github.io/docs/configuration.html#devtool - noInfo: true, // set to false to see a list of every file being bundled. entry: path.resolve(__dirname, 'src/index'), target: 'web', // necessary per https://webpack.github.io/docs/testing.html#compile-and-test output: { @@ -30,9 +28,6 @@ export default { // Hash the files using MD5 so that their names change when the content changes. new WebpackMd5Hash(), - // Optimize the order that items are bundled. This assures the hash is deterministic. - new webpack.optimize.OccurenceOrderPlugin(), - // Tells React to build in prod mode. https://facebook.github.io/react/downloads.html new webpack.DefinePlugin(GLOBALS), @@ -60,24 +55,32 @@ export default { trackJSToken: '' }), - // Eliminate duplicate packages when generating bundle - new webpack.optimize.DedupePlugin(), - // Minify JS - new webpack.optimize.UglifyJsPlugin() + new webpack.optimize.UglifyJsPlugin({ sourceMap: true }), + + new webpack.LoaderOptionsPlugin({ + minimize: true, + debug: false, + noInfo: true, // set to false to see a list of every file being bundled. + options: { + sassLoader: { + includePaths: [path.resolve(__dirname, 'src', 'scss')] + }, + context: '/', + postcss: () => [autoprefixer], + } + }) ], module: { - loaders: [ - {test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel'}, - {test: /\.eot(\?v=\d+.\d+.\d+)?$/, loader: 'url?name=[name].[ext]'}, - {test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&mimetype=application/font-woff&name=[name].[ext]'}, - {test: /\.[ot]tf(\?v=\d+.\d+.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream&name=[name].[ext]'}, - {test: /\.svg(\?v=\d+.\d+.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml&name=[name].[ext]'}, - {test: /\.(jpe?g|png|gif)$/i, loader: 'file?name=[name].[ext]'}, - {test: /\.ico$/, loader: 'file?name=[name].[ext]'}, - {test: /(\.css|\.scss)$/, loader: ExtractTextPlugin.extract('css?sourceMap!postcss!sass?sourceMap')}, - {test: /\.json$/, loader: "json"} + rules: [ + {test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader'}, + {test: /\.eot(\?v=\d+.\d+.\d+)?$/, loader: 'url-loader?name=[name].[ext]'}, + {test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff&name=[name].[ext]'}, + {test: /\.[ot]tf(\?v=\d+.\d+.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream&name=[name].[ext]'}, + {test: /\.svg(\?v=\d+.\d+.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml&name=[name].[ext]'}, + {test: /\.(jpe?g|png|gif)$/i, loader: 'file-loader?name=[name].[ext]'}, + {test: /\.ico$/, loader: 'file-loader?name=[name].[ext]'}, + {test: /(\.css|\.scss)$/, loader: ExtractTextPlugin.extract('css-loader?sourceMap!postcss-loader!sass-loader?sourceMap')} ] - }, - postcss: ()=> [autoprefixer] + } };