-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebpack.config.js
82 lines (81 loc) · 2.71 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const path = require('path');
const CopyWebpackPlugin = require("copy-webpack-plugin");
const ExtractTextPlugin = require("mini-css-extract-plugin");
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const bourbon = require('bourbon');
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: {
index: './assets/js/index.js'
},
output: {
path: __dirname + "/builtAssets",
publicPath: "/assets/",
filename: 'js/[name].js'
},
module: {
rules: [
{
test: /(!opencv)\.js?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['env'],
plugins: ['transform-runtime']
}
},
{
test: /\.worker\.js$/,
use: {
loader: 'worker-loader',
options: {
name: 'js/[name].js'
}
}
},
{
test: /\.s?css$/,
use: [
ExtractTextPlugin.loader,
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
includePaths: [
path.resolve(
__dirname,
'node_modules/purecss-sass/vendor/assets/stylesheets'
),
bourbon.includePaths
]
}
}
]
},
{
test: /\.(jpg|gif|png|svg)$/,
loader: "file-loader?name=img/[name].[ext]"
},
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?name=fonts/[name].[ext]&limit=10000&minetype=application/font-woff" },
{ test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader?name=fonts/[name].[ext]" }
]
},
plugins: [
new CopyWebpackPlugin([{ from: 'assets/img', to: 'img' }]),
new CopyWebpackPlugin([{ from: 'assets/wasm', to: 'wasm' }]),
new ExtractTextPlugin({
filename: 'css/[name].css',
chunkFilename: 'css/[id].css'
}),
new webpack.LoaderOptionsPlugin({
options: {
postcss: function() {
return [ autoprefixer ];
}
}
}),
],
node: { fs: 'empty' }
};