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
If an ESM file is transformed with transformMixedEsModules=true (for require support), it shouldn't replace typeof exports by 'object' and leave it as-is (or replace by 'undefined' ?)
Activity
yunsii commentedon Dec 8, 2021
Any progress? lodash-es cause the same error, when I use Vite with
transformMixedEsModules=true.fix(commonjs): do not transform "typeof exports" for mixed modules
lukastaegert commentedon Dec 10, 2021
I added a fix to #1038
fix(commonjs): do not transform "typeof exports" for mixed modules
fix(commonjs): do not transform "typeof exports" for mixed modules
yunsii commentedon Dec 17, 2021
Hello, when will it be released?
shellscape commentedon Dec 17, 2021
@theprimone we don't have a release schedule. please exercise patience.
yunsii commentedon Dec 17, 2021
Well,how can I make a workaround?It causes error after bundled, though I try to configure
exclude.yunsii commentedon Dec 19, 2021
It looks like version
@rollup/plugin-commonjs@22.0.0-4fixes the problem for now, detail: https://unpkg.com/browse/@rollup/plugin-commonjs@22.0.0-4/dist/index.es.jsfix(commonjs): do not transform "typeof exports" for mixed modules
fix(commonjs): do not transform "typeof exports" for mixed modules
fix(commonjs): do not transform "typeof exports" for mixed modules
webhao commentedon Feb 10, 2022
@yunsii I didn't solve it.update
@rollup/plugin-commonjs@22.0.0-9,usecommonjsOptions: { transformMixedEsModules: true, strictRequires: true, }yunsii commentedon Feb 10, 2022
The same error:
exports is not defined? I replacerequirewithimport ... from ...and remove commonjs plugin finnally 😂fix(commonjs): do not transform "typeof exports" for mixed modules
fix(commonjs): do not transform "typeof exports" for mixed modules
mccxiv commentedon Feb 24, 2022
Workaround while waiting for the fix to release:
Add
window.exports = undefinedbefore anything else executes.For me, I had to do it in a separate script tag above the main file:
fix(commonjs): do not transform "typeof exports" for mixed modules
superchangme commentedon Mar 30, 2022
help me vite 2.6.8 still has this problem Uncaught ReferenceError: exports is not defined
fix(commonjs): do not transform "typeof exports" for mixed modules
fix(commonjs): do not transform "typeof exports" for mixed modules
fix(commonjs): support CJS modules re-exporting transpiled ESM modules (
fix(commonjs): do not transform "typeof exports" for mixed modules
fix(commonjs): support CJS modules re-exporting transpiled ESM modules (
fix(commonjs): do not transform "typeof exports" for mixed modules (#…
fix(commonjs): do not transform "typeof exports" for mixed modules (#…