Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

express-minify +terser ? #61

Open
LSafer opened this issue Nov 18, 2020 · 0 comments
Open

express-minify +terser ? #61

LSafer opened this issue Nov 18, 2020 · 0 comments

Comments

@LSafer
Copy link

LSafer commented Nov 18, 2020

I got an overall idea about what is going on. I understood that terser the module to uglify modern JS. But, I tried to use it using the uglifyJsModule. It looks like it is not compatible with express-minify.

Code:

const _express_minify = require('express-minify');
const _terser = require('terser');
app.use(_express_minify({
    cache: false,
    jsMatch: /javascript|js/g,
    errorHandler: error => {
        console.error(error);
    },
    uglifyJsModule: _terser
}));

Output:

_http_outgoing.js:696
    throw new ERR_INVALID_ARG_TYPE('first argument',
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer or Uint8Array. Received undefined
    at write_ (_http_outgoing.js:696:11)
    at ServerResponse.write (_http_outgoing.js:661:15)
    at C:\Projects\openstore\node_modules\express-minify\index.js:151:23
    at MemoryCache.put (C:\Projects\openstore\node_modules\express-minify\cache.js:46:3)
    at C:\Projects\openstore\node_modules\express-minify\index.js:150:27
    at C:\Projects\openstore\node_modules\express-minify\minifier.js:173:5
    at Minifier._minifyJavaScript (C:\Projects\openstore\node_modules\express-minify\minifier.js:63:3)
    at Minifier._compileAndMinify (C:\Projects\openstore\node_modules\express-minify\minifier.js:155:15)
    at Minifier.compileAndMinify (C:\Projects\openstore\node_modules\express-minify\minifier.js:164:8)
    at C:\Projects\openstore\node_modules\express-minify\index.js:144:20 {
  code: 'ERR_INVALID_ARG_TYPE'
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant