-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Production build error in codebases using jsondiffpatch package with Vite version above @4.0.2 #11986
Comments
in 4.0.3 https://github.com/vitejs/vite/blob/v4.0.3/packages/vite/CHANGELOG.md, @rollup/plugin-commonjs is bumped to 24 from 23, the breaking change is rollup/plugins#1358. You may can fix this by turning |
@fi3ework I just tried out this option and no success unfortunately:/ |
I tested this with rollup. The change is rollup/plugins#1363. |
@sapphi-red Nice one! Thank you:) |
I've added a new plugin to {
// https://github.com/vitejs/vite/issues/11986
// https://github.com/rollup/rollup/issues/4861
name: 'my:jsondiffpatch',
configResolved() {
const cjsFile = require.resolve('jsondiffpatch');
const cjsCode = fs.readFileSync(cjsFile, 'utf-8');
const cjsModifiedCode = cjsCode.replace(
`var chalk = _interopDefault(require('chalk'));`,
'var chalk = null;',
);
fs.writeFileSync(cjsFile, cjsModifiedCode);
const esmFile = file.replace(
path.join('jsondiffpatch.cjs.js'),
path.join('jsondiffpatch.esm.js'),
);
const esmCode = fs.readFileSync(esmFile, 'utf-8');
const esmModifiedCode = esmCode.replace(
`import chalk from 'chalk';`,
'const chalk = null;',
);
fs.writeFileSync(esmFile, esmModifiedCode);
},
}, |
I tested rollup/plugins#1455 and it worked. |
Beautiful! I hope Vite will release a new version including this new version of the rollup |
https://www.npmjs.com/package/jsondiffpatch-rc |
Describe the bug
I was trying to update Vite to the version of 4.1.1 in our company and I was facing an error saying:
Uncaught TypeError: Cannot read properties of undefined (reading 'close')
from vendor.js file.I knew it is coming from a node_modules deps, but I had no clue which package exactly and we got stuck. Finally I figured it out so I created a dummy project including that package:
jsondiffpatch
.I downgraded vite to 4.1.1, 4.0.4, 4.0.3 - Failing
I downgraded vite to 4.0.2 and lower - Working
I feel there was a breaking change in releasing [email protected] and if I had to guess I would say it's the commonjs update.
Reproduction
https://github.com/bpetii/Vite-issue-reproduction
Steps to reproduce
yarn run server
commandlocalhost:3000
in a browserSystem Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: