1
0
Fork 0
scratchy/webpack.config.js

61 lines
1.3 KiB
JavaScript

const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CopyPlugin = require('copy-webpack-plugin');
const ExecaPlugin = require("execa-webpack-plugin");
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: [
'./js/script.js',
'./scss/style.scss'
],
plugins: [
new MiniCssExtractPlugin(),
new ExecaPlugin({
onBeforeRun: [
{
cmd: "inklecate",
args: ["game/game.ink"],
options: {
cwd: process.cwd()
}
}
]
}),
new CopyPlugin({
patterns: [
{ from: './html/', to: '' },
{ from: './game/*.json', to: '' },
],
}),
],
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
// Translates CSS into CommonJS
'css-loader',
'postcss-loader',
// Compiles Sass to CSS
'sass-loader'
]
},
]
},
output: {
path: path.resolve(__dirname, 'build')
}
}