Skip to content

Commit

Permalink
misc webpack tweaks (go-gitea#9924)
Browse files Browse the repository at this point in the history
- reduce verbosity during build
- use array form `use` to allow easier extension
- disable uninteresting source maps
- disable symlink resolution for a speedup

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
  • Loading branch information
3 people authored and lunny committed Jan 22, 2020
1 parent 81daf26 commit c7fe028
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ js: node-check fomantic $(JS_DEST)

$(JS_DEST): node_modules $(JS_SOURCES)
npx eslint web_src/js webpack.config.js
npx webpack
npx webpack --hide-modules --display-entrypoints=false

.PHONY: fomantic
fomantic: node-check $(FOMANTIC_DEST_DIR)
Expand Down
51 changes: 29 additions & 22 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,31 @@ module.exports = {
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
}
]
],
plugins: [
[
'@babel/plugin-transform-runtime',
{
regenerator: true,
}
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
}
]
],
'@babel/plugin-proposal-object-rest-spread',
],
}
}
plugins: [
[
'@babel/plugin-transform-runtime',
{
regenerator: true,
}
],
'@babel/plugin-proposal-object-rest-spread',
],
}
},
],
},
{
test: /\.css$/i,
Expand All @@ -73,6 +75,8 @@ module.exports = {
new SourceMapDevToolPlugin({
filename: '[name].js.map',
exclude: [
'gitgraph.js',
'jquery.js',
'swagger.js',
],
}),
Expand All @@ -84,4 +88,7 @@ module.exports = {
return !filename.endsWith('.map') && filename !== 'swagger.js';
}
},
resolve: {
symlinks: false,
}
};

0 comments on commit c7fe028

Please sign in to comment.