nx 9.4.x doesn't use browser entry point properly
See original GitHub issueCurrent Behavior
nx 9.4.5 builds React library with node modules, instead of browser modules.
Expected Behavior
As nx 9.3.0 did, build the lib with browser modules.
Steps to Reproduce
I’ve done the exact same thing with both nx 9.4.5 and 9.3.0.
npx create-nx-workspace
with Reactnx g @nrwl/react:lib mylib --js --publishable
- Install
uuid
and make the appropriate code change
nx 9.4.5
-
npm i
-
npx nx build mylib
-
Notice the following errors:
'crypto' is imported by node_modules/uuid/dist/esm-node/rng.js, but could not be resolved – treating it as an external dependency 'crypto' is imported by node_modules/uuid/dist/esm-node/md5.js, but could not be resolved – treating it as an external dependency 'crypto' is imported by node_modules/uuid/dist/esm-node/sha1.js, but could not be resolved – treating it as an external dependency
If you look at the dist/libs/mylib/mylib.esm.js
, you’ll notice that indeed the module is trying to import crypto
:
import crypto from "crypto";
nx 9.3.0
- Clone https://github.com/gsong/nx-rollup-problem/tree/nx-9.3
npm i
npx nx build mylib
Success! dist/libs/mylib/mylib.esm.js
imports from uuid
instead:
import { v4 } from "uuid";
Environment
nx 9.4.5
@nrwl/angular : Not Found @nrwl/cli : 9.4.5 @nrwl/cypress : 9.4.5 @nrwl/eslint-plugin-nx : 9.4.5 @nrwl/express : Not Found @nrwl/jest : 9.4.5 @nrwl/linter : 9.4.5 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : 9.4.5 @nrwl/schematics : Not Found @nrwl/tao : 9.4.5 @nrwl/web : 9.4.5 @nrwl/workspace : 9.4.5 typescript : 3.8.3
nx 9.3.0
@nrwl/angular : Not Found @nrwl/cli : 9.3.0 @nrwl/cypress : 9.3.0 @nrwl/eslint-plugin-nx : 9.3.0 @nrwl/express : Not Found @nrwl/jest : 9.3.0 @nrwl/linter : 9.3.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : 9.3.0 @nrwl/schematics : Not Found @nrwl/tao : 9.3.0 @nrwl/web : 9.3.0 @nrwl/workspace : 9.3.0 typescript : 3.8.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Different main entry point in package.json for node and browser
json - I don't believe webpack or the browser know or care about package.json for the most part, so you should just set...
Read more >NX 10 for Engineering Design - MST.edu
2.1 Starting an NX 10 Session and Opening Files . ... 9.4.3 Finishing Profile . ... In a 2D environment, any point has...
Read more >The Custom executor - GitLab Docs
Below is an example of configuration for the Custom executor using all ... name: my-postgres:9.4 alias: pg entrypoint: ["path", "to", "entrypoint"] command: ...
Read more >Release Notes for the Cisco ASA Series, 9.14(x)
For secure SNMP polling over a site-to-site VPN, include the IP address of the outside interface in the crypto map access-list as part...
Read more >Chapter 2. Securing Your Network Red Hat Enterprise Linux 6
Locking GNOME Using gnome-screensaver-command ... 2.8.9.4.1. ... While creating secure passwords is imperative, managing them properly is also important, ...
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 Free
Top 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
@ZackDeRose I had this with the latest and greatest, I’ll create a repro.
Appreciate it @beeman!