nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.72k stars 2.37k forks source link

After upgrading to 15.7.0 my dynamic import fails #16316

Closed TriPSs closed 1 year ago

TriPSs commented 1 year ago

Current Behavior

I'm getting the following Webpack warning:

WARNING in ./src/translations/index.ts 41:75-86
Critical dependency: the request of a dependency is an expression

Expected Behavior

That it compiles all the locales json files into the main.js

GitHub Repo

No response

Steps to Reproduce

export default new TranslationsService(projectId, async function () {
  const translations = new Map()

  await Promise.all(locales.map((locale) => (
    import(
      /* webpackInclude: /\.json$/ */
      /* webpackMode: "lazy-once" */
      /* webpackPrefetch: true */
      /* webpackPreload: true */
      `./${locale.code}.json`
      )
      .then((module) => (
        translations.set(locale.code, module.default)
      ))
  )))

  return translations
})

Nx Report

nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/devkit            : 15.9.2
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/nest              : 15.9.2
   @nrwl/next              : 15.9.2
   @nrwl/node              : 15.9.2
   @nrwl/nx-plugin         : 15.9.2
   @nrwl/react             : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/web               : 15.9.2
   @nrwl/webpack           : 15.9.2
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   @jscutlery/semver                 : 2.30.1
   @nx-extend/changelog-notify       : 1.0.2
   @nx-extend/e2e-runner             : 2.3.2
   @nx-extend/firebase-hosting       : 2.2.2
   @nx-extend/gcp-cloud-run          : 3.4.5
   @nx-extend/gcp-deployment-manager : 2.4.7
   @nx-extend/gcp-functions          : 6.5.2
   @nx-extend/gcp-secrets            : 3.3.3
   @nx-extend/gcp-storage            : 1.0.6
   @nx-extend/playwright             : 1.2.1
   @nx-extend/pulumi                 : 0.1.2
   @nx-extend/strapi                 : 3.5.1
   @nx-extend/terraform              : 0.0.4
   @nx-extend/translations           : 7.3.0-alpha.1
   @nx-extend/vercel                 : 1.8.3
   @nx-plus/docusaurus               : 15.0.0-rc.0

Failure Logs

No response

Additional Information

No response

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] commented 11 months ago

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.