Skip to content

Commit

Permalink
Added webpack to compile JS scripts. (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
italodr authored Jun 28, 2022
1 parent a0813e5 commit 8968ce8
Show file tree
Hide file tree
Showing 5 changed files with 2,276 additions and 405 deletions.
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ module.exports = function (gulp) {
maintainScope: false,
overridePattern: false,
pattern: [
'@netzstrategen/twig-asset',
'del',
'minimist',
'path',
'node-sass-magic-importer',
'@netzstrategen/twig-asset'
'path',
'vinyl-named',
'webpack',
'webpack-stream',
],
rename: {
'@netzstrategen/twig-asset': 'twigAsset',
'node-sass-magic-importer': 'magicImporter',
'@netzstrategen/twig-asset': 'twigAsset'
'vinyl-named': 'named',
'webpack-stream': 'webpackStream',
}
});

Expand Down
45 changes: 45 additions & 0 deletions lib/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const terserWebpack = require('terser-webpack-plugin');

module.exports = {
mode: process.env.NODE_ENV || 'production',
cache: true,
devtool: process.env.NODE_ENV === 'development' ? 'eval' : false,
stats: {
entrypoints: false,
children: false
},
optimization: {
minimizer: [
new terserWebpack({
parallel: true,
terserOptions: {
ecma: 8,
compress: { warnings: false },
keep_classnames: true,
keep_fnames: true,
output: {
comments: false,
beautify: false
}
}
})
]
},
plugins: [],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
}
}
]
}
]
}
};
Loading

0 comments on commit 8968ce8

Please sign in to comment.