can't add less as dependency
See original GitHub issueDo NOT ignore this template or your issue will have a very high chance to be closed without comment.
Describe the bug
I use vite generate a project,Everything is fun after i install less as a dependency.
System Info
- required
vite
version: 1.0.0-rc.4 - required Operating System: mac10.15.6
- required Node version: 14.10.1
- Optional:
- npm/yarn version yarn-1.21.1
- Installed
vue
version (fromyarn.lock
orpackage-lock.json
) 3.0.0-rc.12 - Installed
@vue/compiler-sfc
version 3.0.0-rc.12
Logs (Optional if provided reproduction)
- Run
vite
orvite build
with the--debug
flag. - Provide the error log here.
yarn run v1.21.1
warning package.json: No license field
$ vite --debug
vite v1.0.0-rc.4
vite:config env mode: development +0ms
vite:config env: {} +1ms
vite:config config resolved in 3ms +1ms
vite:resolve (node_module entry) date-fns -> esm/index.js +0ms
vite:optimize optimizing date-fns (contains relative imports) +0ms
vite:resolve (node_module entry) less -> ./lib/less-node/index +6ms
vite:resolve (postfix) /Users/yuli/work/vite-test/node_modules/less/lib/less-node/index -> /Users/yuli/work/vite-test/node_modules/less/lib/less-node/index.js +0ms
vite:optimize optimizing less (no exports, likely commonjs) +2ms
vite:resolve (node_module entry) vue -> dist/vue.runtime.esm-bundler.js +2ms
vite:optimize optimizing vue (imports sub dependencies) +1ms
[vite] Optimizable dependencies detected:
date-fns, less, vue
Pre-bundling them to speed up dev server page load...
(this will be run only when your dependencies have changed)
[vite] Dep optimization failed with error:
Dependency graceful-fs is attempting to import Node built-in module fs.
This will not work in a browser environment.
Imported by: node_modules/graceful-fs/graceful-fs.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.
Graceful-fs is a optionalDependency of Less
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Unable to resolve dependency tree error when installing npm ...
You have dependency conflict (incorrect and potentially broken dependency) as it says, so try to run the command with --force , or --legacy-peer ......
Read more >Unable to add to dependencies tab of applications or bundles
The problem I now have is this: since upgrading, I can no longer add applications under the Dependencies tab of any application or...
Read more >Fixing security vulnerabilities in npm dependencies in less ...
In my case mocha(7.1.0) -> mkdirp(0.5.1) -> minimist(0.0.8) — the vulnerable version. For npm users, we need one more step for that resolutions...
Read more >Command Line Usage - Less CSS
Install These Tools navigate to your local less. js repository and run npm install this installs less' npm dependencies.
Read more >Dependents - IRS
cannot claim her as a dependent because she is filing a joint return with her ... the dependent's gross income for the tax...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you don’t want this behavior, you can add them into
exclude
insideoptimizeDeps
.How to support
require