traxxx/webpack.config.js

95 lines
1.9 KiB
JavaScript
Raw Normal View History

2020-09-25 19:21:26 +00:00
const webpack = require('webpack');
2020-09-08 14:52:31 +00:00
const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');
2020-09-08 14:52:31 +00:00
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const autoprefixer = require('autoprefixer');
const ESLintPlugin = require('eslint-webpack-plugin');
2020-09-08 14:52:31 +00:00
module.exports = {
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',
options: {
preserveWhitespace: false,
},
},
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
plugins: [
'@babel/plugin-proposal-object-rest-spread',
],
},
},
],
},
{
2021-04-27 01:56:38 +00:00
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
sourceMap: true,
url: false,
},
},
{
loader: 'postcss-loader',
options: {
2021-11-20 22:59:15 +00:00
postcssOptions: {
plugins: [autoprefixer],
},
sourceMap: true,
},
},
2021-02-23 01:33:16 +00:00
{
loader: 'sass-loader',
options: {
sourceMap: true,
additionalData: '@import "assets/css/_breakpoints.scss";',
2021-02-23 01:33:16 +00:00
},
},
],
},
{
test: /\.svg/,
use: 'raw-loader',
},
],
},
plugins: [
new VueLoaderPlugin(),
new ESLintPlugin(),
new MiniCssExtractPlugin({
filename: '../css/style.css',
}),
2020-09-25 19:21:26 +00:00
new webpack.DefinePlugin({
VERSION: JSON.stringify(process.env.npm_package_version),
}),
],
resolve: {
alias: {
theme: path.join(__dirname, 'assets/css/_theme.scss'),
2020-07-05 02:40:57 +00:00
breakpoints: path.join(__dirname, 'assets/css/_breakpoints.scss'),
config: path.join(__dirname, `assets/js/config/${process.env.NODE_ENV || 'default'}.js`),
vue: 'vue/dist/vue.esm-bundler.js',
},
},
};