Skip to content
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

Nx Migrate broke my build #9719

Closed
joshribakoff-sm opened this issue Apr 6, 2022 · 6 comments
Closed

Nx Migrate broke my build #9719

joshribakoff-sm opened this issue Apr 6, 2022 · 6 comments
Assignees
Labels
outdated scope: react Issues related to React support for Nx type: bug

Comments

@joshribakoff-sm
Copy link

joshribakoff-sm commented Apr 6, 2022

Current Behavior

Broke the build

Expected Behavior

Migrate should keep the build green

Steps to Reproduce

I started with the env in #9662 and ran the upgrade to latest NX as described in #9662 (comment)

Workaround

I manually made these changes
Screen Shot 2022-04-06 at 2 58 58 PM

as suggested in #7924 (comment)

Is there a reason that issue remains closed despite plethora of users reporting the issue is still present?

Failure Logs

WARNING in DefinePlugin
Conflicting values for 'process.env.NODE_ENV'

Environment

Before, I had the env in #9662

Now, after running the migrations I have:


 >  NX   Report complete - copy this into the issue template

   Node : 16.13.2
   OS   : darwin x64
   npm  : 8.1.2
   
   nx : 13.9.7
   @nrwl/angular : Not Found
   @nrwl/cypress : 13.9.7
   @nrwl/detox : Not Found
   @nrwl/devkit : 13.9.7
   @nrwl/eslint-plugin-nx : 13.9.7
   @nrwl/express : 13.9.7
   @nrwl/jest : 13.9.7
   @nrwl/js : 13.9.7
   @nrwl/linter : 13.9.7
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 13.9.7
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 13.9.7
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 13.9.7
   @nrwl/web : 13.9.7
   @nrwl/workspace : 13.9.7
   typescript : 4.4.4
   rxjs : 7.5.4
   ---------------------------------------
   Community plugins:
         @nx-tools/nx-docker: 2.3.0

(node:85210) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/jribakoff/groundwater/node_modules/tslib/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
@matthiasbayer
Copy link

Same issue here. Upgrading from 13.4.6 to 13.9.7 broke the build process.

@joshribakoff-sm
Copy link
Author

joshribakoff-sm commented Apr 7, 2022

After deleting my node_modules and re-installing, it's broken again, so the above workaround is not sufficient. For now, I've had to revert the PR that upgraded Nx to restore by build.

@AgentEnder AgentEnder added the scope: react Issues related to React support for Nx label Apr 21, 2022
@jaysoo
Copy link
Member

jaysoo commented Apr 21, 2022

Can you test this on 13.10? It is also fixed in the new 14.0 release.

The issue should be fixed in both for @nrwl/web:webpack executor.

@jaysoo jaysoo self-assigned this Apr 21, 2022
@jaysoo
Copy link
Member

jaysoo commented May 2, 2022

I'm going to close this issue as it has been fixed in both 13.10 and 14.0.

If you continue to experience issues, make sure you are using one of the above versions, and then also check that you don't set NODE_ENV to a value that conflicts with --configuration=<config name>.

@jaysoo jaysoo closed this as completed May 2, 2022
@MoiseScalzo
Copy link

@jaysoo pls check the documentation about custom environment variables:
https://nx.dev/guides/environment-variables#using-environment-variables-in-angular-applications

the suggested changes about webpack, cause the warning.
I temporarily fixed changing from this:

const raw = Object.keys(process.env)
    .filter((key) => NX_APP.test(key))
    .reduce(
      (env, key) => {
        env[key] = process.env[key];
        return env;
      },
      {
        NODE_ENV: process.env.NODE_ENV || configuration,
      }
    );

to this:

  const raw = Object.keys(process.env)
    .filter((key) => NX_APP.test(key))
    .reduce(
      (env, key) => {
        env[key] = process.env[key];
        return env;
      },
      process.env.NODE_ENV === 'production' ? {
        NODE_ENV: process.env.NODE_ENV || configuration,
      } : {}
    );

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react Issues related to React support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

5 participants