-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.base.config.js
69 lines (67 loc) · 1.68 KB
/
webpack.base.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
var webpack = require('webpack')
var path = require('path')
module.exports = {
entry: './app/main.js',
output: {
path: path.resolve(__dirname, './staticnew'),
//Watching your source files for changes and when changes are made the
//bundle will be recompiled. This modified bundle is served from memory at
// the relative path specified in publicPath (see API).
publicPath: '/',
filename: 'build.js'
},
resolve: {
modulesDirectories: [
'node_modules',
],
alias: {
// 'components': path.resolve(__dirname, 'app/components'),
'font': path.resolve(__dirname, 'app/assets/fonts')
},
extensions: ['', '.json', '.js', '.vue'],
},
module: {
loaders:[
{
test: /\.js$/,
loader: 'babel',
exclude: /(node_modules|bower_components)/,
query: {
presets: ['stage-0', 'es2015'], // stage-0 is es7 rule , ex:like {...state}
},
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.vue$/,
loader: 'vue',
},
{
test: /\.(png|jpg|gif)$/,
loader: 'file?name=[name].[ext]?[hash]'
},
{ test: /\.(woff|woff2|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&name=fonts/[hash:8].[name].[ext]'},
],
noParse: [],
},
vue: {
postcss: [
// 让import '*.scss' 也生效
require('postcss-import')({
addDependencyTo: webpack
}),
require('autoprefixer')({
browsers: ['last 3 versions'],
}),
require('cssnano')({ safe: true })
],
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
]
}