-
Notifications
You must be signed in to change notification settings - Fork 145
/
webpack.config.js
51 lines (48 loc) · 1.15 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const LiveReloadPlugin = require('webpack-livereload-plugin')
// const StyleLintPlugin = require('stylelint-webpack-plugin');
const path = require('path')
const loaders = require('./loaders.json').loaders
function getEntries() {
const tempObj = {}
const tempLoaders = loaders.map(loader => {
return tempObj[loader] = path.resolve(__dirname, 'src/' + loader + '.sass');
});
return tempObj
}
module.exports = {
context: __dirname,
name: 'css',
entry: getEntries(),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.sass$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { minimize: true } },
'sass-loader',
]
}
]
},
plugins: [
// new StyleLintPlugin(options),
new MiniCssExtractPlugin('[name].css'),
new LiveReloadPlugin()
],
devServer: {
contentBase: [
path.join(__dirname, 'dist'),
path.join(__dirname, 'examples')
],
compress: true,
hot: true,
open: true,
port: 3000
}
}