From 79048018c5bbb6bbe4f182e5df0ffbd25d9f30d1 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Sun, 15 Jan 2017 11:24:51 -0600 Subject: [PATCH] Update webpack config. --- bikeshop_project/package.json | 4 ++-- bikeshop_project/webpack.base.config.js | 3 +-- bikeshop_project/webpack.prod.config.js | 8 +++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bikeshop_project/package.json b/bikeshop_project/package.json index 026aefc..12d88cf 100644 --- a/bikeshop_project/package.json +++ b/bikeshop_project/package.json @@ -16,7 +16,8 @@ "material-ui": "^0.16.6", "moment": "^2.13.0", "react": "^15.4.1", - "react-dom": "^15.4.1" + "react-dom": "^15.4.1", + "react-tap-event-plugin": "^2.0.1" }, "devDependencies": { "babel": "^6.5.2", @@ -33,7 +34,6 @@ "postcss-loader": "^0.9.1", "react-addons-css-transition-group": "^15.4.1", "react-hot-loader": "^1.3.0", - "react-tap-event-plugin": "^1.0.0", "react-toolbox": "^0.16.2", "sass-loader": "^3.2.0", "style-loader": "^0.13.1", diff --git a/bikeshop_project/webpack.base.config.js b/bikeshop_project/webpack.base.config.js index 1337d48..6658f0e 100644 --- a/bikeshop_project/webpack.base.config.js +++ b/bikeshop_project/webpack.base.config.js @@ -27,8 +27,7 @@ module.exports = { resolve: { modulesDirectories: [ 'node_modules', - 'bower_components', - path.resolve(__dirname, './node_modules') + 'bower_components' ], extensions: ['', '.js', '.jsx', '.scss'] }, diff --git a/bikeshop_project/webpack.prod.config.js b/bikeshop_project/webpack.prod.config.js index 75bc9b7..17bd9b9 100644 --- a/bikeshop_project/webpack.prod.config.js +++ b/bikeshop_project/webpack.prod.config.js @@ -1,5 +1,6 @@ var webpack = require('webpack') var BundleTracker = require('webpack-bundle-tracker') +const ExtractTextPlugin = require('extract-text-webpack-plugin') var config = require('./webpack.base.config.js') @@ -7,6 +8,7 @@ config.output.path = require('path').resolve('./assets/dist') config.plugins = config.plugins.concat([ new BundleTracker({filename: './webpack-stats-prod.json'}), + new ExtractTextPlugin('react-toolbox.css', {allChunks: true}), // removes a lot of debugging code in React new webpack.DefinePlugin({ @@ -27,7 +29,11 @@ config.plugins = config.plugins.concat([ // Add a loader for JSX files config.module.loaders.push( - { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel' } + { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel' }, + { + test: /(\.scss|\.css)$/, + loader: ExtractTextPlugin.extract('style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass?sourceMap!toolbox') + } ) module.exports = config \ No newline at end of file