You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered this problem while trying to minify a file from lodash. This ultimately fails my build with the following error:
Module parse failed: Identifier 'o' has already been declared (1:194)
Input code
Original Reproducer:
// https://github.com/lodash/lodash/blob/master/.internal/baseToString.jsimportSymbolfrom'./_Symbol.js';importarrayMapfrom'./_arrayMap.js';importisArrayfrom'./isArray.js';importisSymbolfrom'./isSymbol.js';/** Used as references for various `Number` constants. */varINFINITY=1/0;/** Used to convert symbols to primitives and strings. */varsymbolProto=Symbol ? Symbol.prototype : undefined,symbolToString=symbolProto ? symbolProto.toString : undefined;/** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */functionbaseToString(value){// Exit early for strings to avoid a performance hit in some environments.if(typeofvalue=='string'){returnvalue;}if(isArray(value)){// Recursively convert values (susceptible to call stack limits).returnarrayMap(value,baseToString)+'';}if(isSymbol(value)){returnsymbolToString ? symbolToString.call(value) : '';}varresult=(value+'');return(result=='0'&&(1/value)==-INFINITY) ? '-0' : result;}exportdefaultbaseToString;
The function should have a unique name and should not collide with the imports.
Actual behavior
The function exported as the default export has the same name as one of the imports which is invalid esm code and fails to parse both in the browser and in nodejs.
Version
1.3.68
Additional context
No response
The text was updated successfully, but these errors were encountered:
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
I encountered this problem while trying to minify a file from lodash. This ultimately fails my build with the following error:
Input code
Original Reproducer:
Minimal Reproducer:
Config
Playground link
https://play.swc.rs/?version=1.3.66&code=H4sIAAAAAAAAA11UTW%2FaQBS8I%2FEf5hQDTUx6JUKkh1biUFQl9JBTWMxz2dbetXbXbhDiv%2FfthynAyft23rx54zGybrRxeD3UW12hNLpGlk%2Ff4zn%2FbbOn4UBGjDBGHL6L5j%2Bqr1zjpP3i62dYOt%2BCbkb2hQQbDq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Z1OMuWOA3reEkORBrg1COFKvC4BGQAGE2s%2B%2FJBGzIe4tF0Efcfa2I%2BcLnt4d6mrs773b5kHCKMENdk%2FB8jsonK3cZJ1ctkP0wv%2FNREaWXwwsvzp2dDUnlafmtSTY%2Bu3CVUNXl9Tn40H4eWl%2BMWpAn0Z2HWQl3%2BAebXfY3kBgAA
Expected behavior
The function should have a unique name and should not collide with the imports.
Actual behavior
The function exported as the default export has the same name as one of the imports which is invalid esm code and fails to parse both in the browser and in nodejs.
Version
1.3.68
Additional context
No response
The text was updated successfully, but these errors were encountered: