aleclarson / vite-tsconfig-paths

Support for TypeScript's path mapping in Vite
MIT License
1.28k stars 45 forks source link

Dep optimization failed with error #2

Closed tomitrescak closed 3 years ago

tomitrescak commented 3 years ago

vite v1.0.0-rc.8 [vite] Optimizable dependencies detected: core-js, vite-tsconfig-paths, vue

[vite] Dep optimization failed with error: Dependency vite-tsconfig-paths is attempting to import Node built-in module path. This will not work in a browser environment. Imported by: node_modules/vite-tsconfig-paths/dist/index.js

Tip: Make sure your "dependencies" only include packages that you intend to use in the browser. If it's a Node.js package, it should be in "devDependencies".

If you do intend to use this dependency in the browser and the dependency does not actually use these Node built-ins in the browser, you can add the dependency (not the built-in) to the "optimizeDeps.allowNodeBuiltins" option in vite.config.js.

If that results in a runtime error, then unfortunately the package is not distributed in a web-friendly format. You should open an issue in its repo, or look for a modern alternative. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

aleclarson commented 3 years ago

Install it as a dev dependency