-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
75 lines (74 loc) · 1.87 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
var ExtractTextPlugin = require('extract-text-webpack-plugin'),
LodashModuleReplacementPlugin = require('lodash-webpack-plugin'),
webpack = require('webpack'),
path = require('path'),
nodeEnv = process.env.NODE_ENV || 'production';
module.exports = {
entry: './src/index.js',
output: {
filename: 'clay-space-edit.js',
path: path.resolve(__dirname, './dist'),
},
// sub in empty modules for Node built-ins
// so webpack doesn't complain about not being able to find the modules
// https://github.com/pugjs/pug-loader/issues/8
node: {
fs: 'empty'
},
module: {
rules: [
{
test: /\.vue$/,
use: [
{
loader: 'vue-loader',
options: {
extractCSS: process.env.NODE_ENV === 'production',
preserveWhitespace: !process.env.NODE_ENV === 'production',
loaders: {
css: 'vue-style-loader!css-loader!postcss-loader',
sass: 'vue-style-loader!css-loader!postcss-loader!sass-loader'
}
}
}
]
},
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
]
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader', // backup loader when not building .css file
use: [
'css-loader',
'sass-loader'
]
})
},
{
test: /\.svg$/,
use: 'raw-loader'
}
]
},
resolve: {
alias: {
references: path.resolve('./src/services/references.js')
}
},
plugins: [
new LodashModuleReplacementPlugin,
new ExtractTextPlugin('clay-space-edit.css'),
new webpack.EnvironmentPlugin(['NODE_ENV'])
]
};