Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32aa650

Browse files
committed
compress attributes
1 parent 885438f commit 32aa650

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

tasks/util/bundle_wrapper.mjs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import path from 'path';
2-
31
import { build } from 'esbuild';
2+
43
import config from '../../esbuild-config.mjs';
4+
import browserifyAdapter from 'esbuild-plugin-browserify-adapter';
5+
6+
import transform from '../../tasks/compress_attributes.js';
57

68
/** Convenience bundle wrapper
79
*
@@ -23,23 +25,13 @@ import config from '../../esbuild-config.mjs';
2325
export default async function _bundle(pathToIndex, pathToBundle, opts, cb) {
2426
opts = opts || {};
2527

26-
var pathToMinBundle = opts.pathToMinBundle;
27-
28-
/*
29-
config.module.rules.push(opts.noCompress ? {} : {
30-
test: /\.js$/,
31-
use: [
32-
'transform-loader?' + path.resolve(__dirname, '../../tasks/compress_attributes.js')
33-
]
34-
});
35-
*/
36-
3728
config.entryPoints = [pathToIndex];
29+
config.outfile = pathToBundle || pathToMinBundle;
30+
config.plugins = opts.noCompress ? [] : [browserifyAdapter(transform)];
3831

32+
var pathToMinBundle = opts.pathToMinBundle;
3933
var pending = (pathToMinBundle && pathToBundle) ? 2 : 1;
4034

41-
config.outfile = pathToBundle || pathToMinBundle;
42-
4335
if(pending === 2) {
4436
config.minify = true;
4537
await build(config);

0 commit comments

Comments
 (0)