npm-package-template icon indicating copy to clipboard operation
npm-package-template copied to clipboard

Warning on build Dynamic import can only be transformed when transforming ES modules to AMD, CommonJS or SystemJS.

Open jankapunkt opened this issue 2 years ago • 3 comments
trafficstars

Describe the bug When building we get the message Dynamic import can only be transformed when transforming ES modules to AMD, CommonJS or SystemJS.

To Reproduce

  1. install
  2. run build script

Expected behavior Build should be either configured to fully support dynamic imports or build targets that don't support dynamic imports should appropriately configured so no warning is raised.

jankapunkt avatar Oct 20 '23 10:10 jankapunkt

Related: https://github.com/babel/babel/issues/14227

jankapunkt avatar Oct 20 '23 10:10 jankapunkt

using this remove the warning { file: 'dist/index.es5.js', format: 'es', plugins: [getBabelOutputPlugin({ presets: [['@babel/preset-env', { modules: false }]] })], sourcemap: true }, I'm strictly not using import() syntax, only import {}
And I'm not a JS guy so not sure this is the correct solution

balosh-daniel avatar Feb 03 '25 08:02 balosh-daniel

Thank you @balosh-daniel I will try it out.

jankapunkt avatar Feb 04 '25 07:02 jankapunkt