Created
June 1, 2018 03:01
-
-
Save SherryH/a2e25df83bd4d84dddcad58917f0b6b6 to your computer and use it in GitHub Desktop.
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 extractSCSS = new ExtractTextPlugin({ | |
filename: 'stylesheets/main.css', | |
disable: IS_DEV, | |
allChunks: true | |
}); | |
const extractCSS = new ExtractTextPlugin({ | |
filename: 'stylesheets/vendor.css', | |
disable: IS_DEV, | |
allChunks: true | |
}); | |
module.exports = { | |
context, | |
entry: { main: path.join(__dirname, './src/index.js') }, | |
output: { | |
path: path.resolve(__dirname, './dist'), | |
publicPath: '/assets', | |
filename: '[name].[chunkhash:4].js' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.css$/, | |
use: extractCSS.extract({ | |
fallback: 'style-loader', | |
use: [{ loader: 'css-loader', options: { minimize: !IS_DEV } }, { loader: 'postcss-loader' }] | |
}) | |
}, | |
{ | |
test: /\.(scss|sass)$/, | |
include: [path.resolve(__dirname, './src/common/'), path.resolve(__dirname, 'node_modules', 'bulma')], | |
use: extractSCSS.extract({ fallback: 'style-loader', use: ['css-loader', 'postcss-loader', 'sass-loader'] }) | |
}, | |
{ | |
test: /\.scss$/, | |
exclude: [path.resolve(__dirname, './src/common/'), path.resolve(__dirname, 'node_modules', 'bulma')], | |
use: extractSCSS.extract({ | |
fallback: 'style-loader', | |
use: [ | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: true, | |
importLoaders: 1, | |
localIdentName: '[name]__[local]___[hash:base64:5]' | |
} | |
}, | |
{ | |
loader: 'postcss-loader', | |
options: { | |
sourceMap: true | |
} | |
}, | |
{ | |
loader: 'sass-loader', | |
options: { | |
includePaths: [path.resolve(__dirname, 'src', 'common')] | |
} | |
} | |
] | |
}) | |
} | |
] | |
}, | |
plugins: [ | |
extractSCSS, | |
extractCSS, | |
new HtmlWebpackPlugin({ | |
title: 'Form Builder', | |
template: path.join(__dirname, '/static/template.html') | |
}), | |
new CleanWebpackPlugin(['dist']) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment