-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
50 lines (49 loc) · 1.24 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
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
module.exports = {
devtool: 'source-map',
entry: {
app: './js/app.js'
},
output: {
path: path.resolve(__dirname, '..', 'priv', 'static'),
filename: 'js/[name].js'
},
plugins: [
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, 'static'),
to: path.resolve(__dirname, '..', 'priv', 'static')
}
]),
new ExtractTextPlugin({ filename: 'css/[name].css', allChunks: true })
],
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [{ loader: 'css-loader', options: { sourceMap: true } }]
})
},
{
test: /\.(jpg|jpeg|gif|png)$/,
exclude: [nodeModulesPath],
loader: 'file-loader'
},
{
test: /\.(woff2?|ttf|eot|svg)(\?[a-z0-9\=\.]+)?$/,
exclude: [nodeModulesPath],
loader: 'file-loader'
}
]
}
};