1
0
mirror of https://github.com/azlux/botamusique synced 2024-11-23 22:06:09 +00:00
botamusique/web/webpack.config.cjs
Tyler Vigario ff5b1cb1ee
Upgrade web assets (#219)
* Update assets

* Upgrade linting and other improvments

* Correct linting

* Correction and type check improvements

* Correct type check lib

* Fix lint pathing for VSCode

* Remove duplicate babel config

* Remove editorconfig root attribute from web subdir

* Use double quotes around message

* Simplify ESLint config

* Update web assets

* Allow AMD loader in WebPack

* Bump web dependencies

* Only include FA icons in-use
2020-11-25 22:08:12 +08:00

84 lines
1.8 KiB
JavaScript

const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'production',
devtool: 'source-map',
entry: {
main: [
'./js/app.mjs',
'./sass/app.scss',
],
dark: [
'./sass/app-dark.scss',
],
},
output: {
filename: 'static/js/[name].js',
path: path.resolve(__dirname, '../'),
},
plugins: [
new MiniCssExtractPlugin({
filename: 'static/css/[name].css',
}),
new HtmlWebpackPlugin({
filename: 'templates/index.template.html',
template: './templates/index.template.html',
inject: false,
}),
new HtmlWebpackPlugin({
filename: 'templates/need_token.template.html',
template: './templates/need_token.template.html',
inject: false,
}),
],
module: {
rules: [{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader', // translates CSS into CommonJS modules
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
'autoprefixer',
{
// Options
},
],
],
},
},
},
'sass-loader', // compiles Sass to CSS
],
},
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
resolve: {
fullySpecified: false,
},
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
'corejs': '3.6',
'useBuiltIns': 'usage',
},
],
],
},
},
},
],
},
};