ibt2/build/webpack.base.conf.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-01-14 12:35:55 +01:00
var path = require('path')
var utils = require('./utils')
var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf')
2017-01-14 12:35:55 +01:00
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
2017-01-14 12:35:55 +01:00
module.exports = {
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
2017-01-14 12:35:55 +01:00
},
resolve: {
extensions: ['.js', '.vue', '.json'],
2017-01-14 12:35:55 +01:00
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
2017-01-14 12:35:55 +01:00
}
},
module: {
rules: [
2017-01-14 12:35:55 +01:00
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
2017-01-14 12:35:55 +01:00
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
2017-01-14 12:35:55 +01:00
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
2017-01-14 12:35:55 +01:00
query: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
2017-01-14 12:35:55 +01:00
query: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
}
}