-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.base.conf.js
executable file
·122 lines (120 loc) · 2.97 KB
/
webpack.base.conf.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
var path = require('path')
var config = require('../config/index')
var utils = require('./utils')
var projectRoot = path.resolve(__dirname, '../')
var webpack = require('webpack')
var program = require('commander')
program
.option('-t, --target [value]', 'bundle target.')
.parse(process.argv)
module.exports = {
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
// this causes absolute path in builds, which makes them non-distribuable on an other machine
// we may not need this in nd at all
// so let's remove it on august, 22th 2016 if no one complains
//publicPath: config.build.assetsPublicPath,
filename: '[name].js'
},
target: program.target || {{#if electron}}'electron-renderer'{{else}}'web'{{/if}},
resolve: {
extensions: ['', '.js', '.vue'],
fallback: [path.join(__dirname, '../node_modules')],
alias: {
'src': path.resolve(__dirname, '../src'),
'assets': path.resolve(__dirname, '../src/assets'),
'components': path.resolve(__dirname, '../src/components'),
'settings': path.resolve(__dirname, '../settings'),
'locales': path.resolve(__dirname, '../locales'),
'data': path.resolve(__dirname, '../src/data'),
'lib': path.resolve(__dirname, '../src/lib')
}
},
resolveLoader: {
fallback: [path.join(__dirname, '../node_modules')]
},
vue: {
autoprefixer: {
browsers: ['last 2 versions']
}
},
module: {
{{#lint}}
preLoaders: [
{
test: /\.vue$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
}
],
{{/lint}}
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
include: projectRoot,
exclude: /node_modules/
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.html$/,
loader: 'vue-html'
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url',
query: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url',
query: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
{{#lint}}
eslint: {
formatter: require('eslint-friendly-formatter')
},
{{/lint}}
vue: {
loaders: utils.cssLoaders()
},
plugins: [ new webpack.DefinePlugin({ 'global.GENTLY': false }) ],
externals: [
(function () {
var IGNORES = [
'electron'
];
return function (context, request, callback) {
if (IGNORES.indexOf(request) >= 0) {
return callback(null, "require('" + request + "')");
}
return callback();
};
})()
]
}