Created
April 28, 2018 00:12
-
-
Save ConnectedReasoning/a30defe473af4e36e03f68a7172810be to your computer and use it in GitHub Desktop.
webpack.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const extractSass = new ExtractTextPlugin({ | |
filename: "[name].[contenthash].css", | |
disable: process.env.NODE_ENV === "development" | |
}); | |
module.exports = { | |
entry: './src/js/app.js', | |
devtool: 'source-map', | |
// mode: 'production', | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'public'), | |
}, | |
devServer: { | |
contentBase: path.join(__dirname, 'public'), | |
compress: true, | |
port: 9000, | |
}, | |
module: { | |
rules: [ | |
{ | |
enforce: 'pre', | |
test: /\.(js|jsx)$/, | |
exclude: /node_modules/, | |
loader: 'eslint-loader' | |
}, | |
{ | |
test: /\.(js|jsx)$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
options: { | |
presets: ['es2015', 'react'], | |
}, | |
}, | |
{ | |
test: /\.scss$/, | |
use: extractSass.extract({ | |
use: [{ | |
loader: "css-loader" | |
}, { | |
loader: "sass-loader" | |
}], | |
// use style-loader in development | |
fallback: "style-loader" | |
}) | |
} | |
], | |
}, | |
plugins: [ | |
extractSass | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment