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

Unable to use TypeScript webpack config with @nrwl/node:build #7704

Closed
tonivj5 opened this issue Nov 11, 2021 · 2 comments · Fixed by #8171
Closed

Unable to use TypeScript webpack config with @nrwl/node:build #7704

tonivj5 opened this issue Nov 11, 2021 · 2 comments · Fixed by #8171
Assignees
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@tonivj5
Copy link

tonivj5 commented Nov 11, 2021

This issue has been fixed for web builder: #7454

Current Behavior

Cannot use import statement outside a module

Expected Behavior

I can use typescript files.

Steps to Reproduce

Same as #7454

Using this webpack.config.ts

import type { Configuration } from 'webpack';

const PRISMA_CLIENT_GENERATED_DEPENDENCIES = ['encoding', '_http_common'];

export default function webpackConfig(webpackConfig: Configuration, options: unknown) {

  if (Array.isArray(webpackConfig.externals)) {
    webpackConfig.externals.push((context, callback) => {
      if (context.request && PRISMA_CLIENT_GENERATED_DEPENDENCIES.includes(context.request)) {
        // not bundled
        return callback(undefined, `commonjs ${context.request}`);
      }

      // bundled
      callback();
    });
  }

  return webpackConfig;
}

Failure Logs

Not works

Environment

  Node : 17.0.1
  OS   : linux x64
  npm  : 6.14.10
  
  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 13.1.4
  @nrwl/cypress : 13.1.4
  @nrwl/devkit : 13.1.4
  @nrwl/eslint-plugin-nx : 13.1.4
  @nrwl/express : Not Found
  @nrwl/jest : 13.1.4
  @nrwl/linter : 13.1.4
  @nrwl/nest : 13.1.4
  @nrwl/next : Not Found
  @nrwl/node : 13.1.4
  @nrwl/nx-cloud : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 13.1.4
  @nrwl/web : 13.1.4
  @nrwl/workspace : 13.1.4
  @nrwl/storybook : Not Found
  @nrwl/gatsby : Not Found
  typescript : 4.4.4

Done in 0.35s.
@AgentEnder AgentEnder added the scope: node Issues related to Node, Express, NestJS support for Nx label Nov 11, 2021
@AgentEnder AgentEnder self-assigned this Nov 11, 2021
@ruslan-byondxr
Copy link

I have the same problem while using custom webpack.config.ts or webpack.config.js

@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 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants