2020-09-25 19:21:26 +00:00
|
|
|
const webpack = require('webpack');
|
2020-09-08 14:52:31 +00:00
|
|
|
const path = require('path');
|
2020-12-26 22:51:27 +00:00
|
|
|
const { VueLoaderPlugin } = require('vue-loader');
|
2020-09-08 14:52:31 +00:00
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
|
|
const autoprefixer = require('autoprefixer');
|
2021-02-23 01:08:10 +00:00
|
|
|
const ESLintPlugin = require('eslint-webpack-plugin');
|
2019-06-03 03:31:38 +00:00
|
|
|
|
2020-09-08 14:52:31 +00:00
|
|
|
module.exports = {
|
2024-01-03 22:03:30 +00:00
|
|
|
entry: {
|
|
|
|
bundle: './assets/js/main.js',
|
|
|
|
},
|
2020-05-14 02:26:05 +00:00
|
|
|
output: {
|
2024-01-03 22:03:30 +00:00
|
|
|
filename: '[name].js',
|
2020-05-14 02:26:05 +00:00
|
|
|
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$/,
|
2020-05-14 02:26:05 +00:00
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
2020-12-26 22:51:27 +00:00
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
url: false,
|
|
|
|
},
|
|
|
|
},
|
2020-05-14 02:26:05 +00:00
|
|
|
{
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
2021-11-20 22:59:15 +00:00
|
|
|
postcssOptions: {
|
|
|
|
plugins: [autoprefixer],
|
|
|
|
},
|
2020-05-14 02:26:05 +00:00
|
|
|
sourceMap: true,
|
|
|
|
},
|
|
|
|
},
|
2021-02-23 01:33:16 +00:00
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
2021-03-07 15:39:54 +00:00
|
|
|
additionalData: '@import "assets/css/_breakpoints.scss";',
|
2021-02-23 01:33:16 +00:00
|
|
|
},
|
|
|
|
},
|
2020-05-14 02:26:05 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.svg/,
|
|
|
|
use: 'raw-loader',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new VueLoaderPlugin(),
|
2021-02-23 01:08:10 +00:00
|
|
|
new ESLintPlugin(),
|
2020-05-14 02:26:05 +00:00
|
|
|
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),
|
|
|
|
}),
|
2020-05-14 02:26:05 +00:00
|
|
|
],
|
|
|
|
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'),
|
2020-05-14 02:26:05 +00:00
|
|
|
config: path.join(__dirname, `assets/js/config/${process.env.NODE_ENV || 'default'}.js`),
|
2021-01-11 15:20:01 +00:00
|
|
|
vue: 'vue/dist/vue.esm-bundler.js',
|
2020-05-14 02:26:05 +00:00
|
|
|
},
|
|
|
|
},
|
2019-06-03 03:31:38 +00:00
|
|
|
};
|