-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
53 lines (51 loc) · 1.19 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
52
53
require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const processHTMLPages = require('./processHTMLHelper.js');
const extractCSS = new ExtractTextPlugin('style.css');
const plugins = [
extractCSS,
].concat(processHTMLPages());
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:3000',
'./source/index.js',
],
module: {
rules: [
{
test: [/\.scss$/i, /\.sass$/i, /\.css$/],
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader']
})
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
query: {
name: '[path][name].[ext]',
context: './source'
}
},
],
},
devServer: {
contentBase: './source',
host: 'localhost',
port: 3000,
headers: { "Access-Control-Allow-Origin": "*" },
},
resolve: {
extensions: ['.js', '.es6'],
},
output: {
path: __dirname + '/build',
filename: 'index.js',
},
plugins,
};