synclounge/build/webpack.base.conf.js

69 lines
1.5 KiB
JavaScript
Raw Normal View History

2017-04-07 05:09:03 +00:00
var path = require('path')
var utils = require('./utils')
2017-06-11 19:06:34 +00:00
var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
2017-04-07 05:09:03 +00:00
module.exports = {
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
2017-06-11 19:06:34 +00:00
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
2017-04-07 05:09:03 +00:00
},
resolve: {
2017-06-11 19:06:34 +00:00
extensions: ['.js', '.vue', '.json'],
2017-04-07 05:09:03 +00:00
alias: {
2017-06-11 19:06:34 +00:00
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src')
2017-04-07 05:09:03 +00:00
}
},
module: {
2017-06-11 19:06:34 +00:00
rules: [
2017-04-07 05:09:03 +00:00
{
test: /\.vue$/,
2017-06-11 19:06:34 +00:00
loader: 'vue-loader',
options: vueLoaderConfig
2017-04-07 05:09:03 +00:00
},
{
test: /\.js$/,
2017-06-11 19:06:34 +00:00
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
2017-04-07 05:09:03 +00:00
},
{
2017-06-11 19:06:34 +00:00
test: /\.styl$/,
loader: ['style-loader', 'css-loader', 'stylus-loader']
2017-04-07 05:09:03 +00:00
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
2017-06-11 19:06:34 +00:00
loader: 'url-loader',
options: {
2017-04-07 05:09:03 +00:00
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
2017-06-11 19:06:34 +00:00
loader: 'url-loader',
options: {
2017-04-07 05:09:03 +00:00
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
console: true,
fs: 'empty',
net: 'empty',
tls: 'empty'
}
}