ERROR in http.min.js from Terser
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- build-system
Research direction
Start with http.js and webpack.build-lib.js, then run the production build that uses mode: 'production' and Terser; compare it with the development build. Trace how the ReplacePlugin output reaches lib/http.min.js and determine why the export is no longer at the top level. Done means the production build completes without the reported Terser error.
Written by the indexing model from the issue text.
Description
When I set webpack config mode: 'production',it throw error:
ERROR in http.min.js from Terser
"Export" statement may only appear at the top level [http.min.js:1161,0]
But when I set mode: 'development',it works...I can't figure out why.
// http.js
const http = () => {}
http.version = '__version__';
export default http;
// webpack.build-lib.js
const path = require('path');
const ReplacePlugin = require('../lib/webpack-plugin-replace');
const rootPath = path.resolve(__dirname, '..');
const pkg = require('../package.json');
const libName = 'http';
const entryFile = path.resolve(rootPath, `src/${libName}.js`);
module.exports = {
entry: entryFile,
mode: 'production',
output: {
path: path.resolve(rootPath, 'lib'),
filename: `${libName}.min.js`,
libraryTarget: 'umd2',
libraryExport: 'default',
},
plugins: [
new ReplacePlugin({
exclude: [
/node_modules/,
],
patterns: [{
regex: /__version__/g,
value: pkg.version,
}],
}),
],
};
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lukeed/webpack-plugin-replace
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
lukeed/webpack-plugin-replace#6 · 8 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
lukeed/webpack-plugin-replace#5 · 1 comment ·
-
Update for Webpack 4 Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
lukeed/webpack-plugin-replace#4 · 2 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in lukeed/webpack-plugin-replace
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·