tasks/webpack.common.js

66 lines
1.3 KiB
JavaScript
Raw Permalink 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: /src\/.*\.(js|vue)$/,
2018-08-30 20:22:27 +00:00
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$/,
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-object-rest-spread'
],
presets: ['@babel/preset-env']
}
},
exclude: /node_modules\/(?!(p-limit|p-defer|p-queue|p-try|cdav-library))/
2018-08-19 20:18:53 +00:00
},
{
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)
2019-03-26 19:39:48 +00:00
})
],
2018-08-19 20:18:53 +00:00
resolve: {
2018-08-30 20:22:27 +00:00
extensions: ['*', '.js', '.vue', '.json']
}
}