-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.base.config.js
54 lines (53 loc) · 1.39 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
const path = require('path');
const projectRoot = path.resolve(__dirname, '../');
const ExtractTextPlugin = require('extract-text-webpack-plugin')
console.log(projectRoot);
// const vueConfig = require('./vue-loader.config');
module.exports ={
entry: './resources/client-entry.js',
output: {
path: path.resolve(__dirname, './public/js'), //打包输出路径
publicPath: '/js/', //请求路径
filename: 'client-bundle.js'
},
module: {
loaders: [
{test: /\.js$/, loaders:
[
'babel-loader',
'eslint-loader'
],
exclude: /node_modules/
},
{
enforce: 'pre',
test: /\.vue$/,
loader: 'eslint-loader',
exclude: /node_modules/
},
// but use vue-loader for all *.vue files
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.png|jpg|gif$/,
// loader: 'url-loader?limit=4000&name=[hash:8].[name].[ext]&outputPath=img/&publicPath=/js/'
loader: 'url-loader',
options: {
limit: 4000,
name: '[hash:8].[name].[ext]',
outputPath: 'img/',
publicPath: '/js/'
}
},
{ test: /\.scss$/, loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
}) }
]
},
plugins: [
new ExtractTextPlugin("styles.css")
]
};