traxxx/webpack.config.babel.js

71 lines
2.0 KiB
JavaScript
Raw Normal View History

import path from 'path';
import VueLoaderPlugin from 'vue-loader/lib/plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import autoprefixer from 'autoprefixer';
export default {
entry: './assets/js/main.js',
output: {
filename: 'bundle.js',
path: path.join(__dirname, 'public/js'),
},
module: {
rules: [
{
test: /\.vue$/,
include: [
path.resolve(__dirname, 'assets'),
],
loader: 'vue-loader',
},
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
plugins: [
'@babel/plugin-proposal-object-rest-spread',
],
},
},
'eslint-loader',
],
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader?sourceMap',
{
loader: 'postcss-loader',
options: {
plugins: [autoprefixer],
sourceMap: true,
},
},
'sass-loader?sourceMap',
],
},
{
test: /\.svg/,
use: 'raw-loader',
},
],
},
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: '../css/style.css',
}),
],
resolve: {
alias: {
theme: path.join(__dirname, 'assets/css/_theme.scss'),
config: path.join(__dirname, `assets/js/config/${process.env.NODE_ENV || 'default'}.js`),
},
},
};