Repository navigation
Replies: 1 comment
|
The I reproduced the raw For a file you own, keep it in // src/tool.js
export default 3;
// App.vue
import a from './tool.js';
console.log(a); // 3If you need the original For an actual CommonJS dependency, install it as a package with a resolvable entry rather than putting a loose JS file directly into export default defineConfig({
plugins: [vue()],
optimizeDeps: { include: ['your-package-name'] },
});A local fixture package with Vite 4's dependency-prebundling guide explains the dev-time esbuild conversion versus production CommonJS handling. These checks cover the small reproduction and generated module, not your complete Vue application; the original dependency versions weren't provided. |
Uh oh!
There was an error while loading. Please reload this page.
i use @rollup/plugin-commonjs in vite
create a file named src/tool.js,
exports["default"] = 3and import in App.vue
but same file in node_module is useless
All reactions