tasks/webpack.common.js

57 lines
1.1 KiB
JavaScript
Raw Normal View History

const path = require('path')
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const StyleLintPlugin = require('stylelint-webpack-plugin')
2018-08-19 20:18:53 +00:00
module.exports = {
entry: path.join(__dirname, 'src', 'main.js'),
2018-08-19 20:18:53 +00:00
output: {
2018-08-30 20:22:27 +00:00
path: path.resolve(__dirname, './js'),
publicPath: '/js/',
filename: 'tasks.js'
2018-08-19 20:18:53 +00:00
},
module: {
rules: [
2018-08-30 20:22:27 +00:00
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.(js|vue)$/,
use: 'eslint-loader',
enforce: 'pre'
},
2018-08-19 20:18:53 +00:00
{
test: /\.vue$/,
2018-08-30 20:22:27 +00:00
loader: 'vue-loader'
2018-08-19 20:18:53 +00:00
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
2019-03-26 19:39:48 +00:00
plugins: [
new VueLoaderPlugin(),
new StyleLintPlugin(),
new webpack.DefinePlugin({
appVersion: JSON.stringify(require('./package.json').version)
})
],
2018-08-19 20:18:53 +00:00
resolve: {
2018-08-30 20:22:27 +00:00
extensions: ['*', '.js', '.vue', '.json']
}
}