wokwi-elements icon indicating copy to clipboard operation
wokwi-elements copied to clipboard

fix issue #149 - add .js to esm modules

Open jogibear9988 opened this issue 2 years ago • 5 comments

jogibear9988 avatar Feb 03 '23 16:02 jogibear9988

so the elements could be used in https://node-projects.github.io/web-component-designer-demo/index.html

jogibear9988 avatar Feb 03 '23 16:02 jogibear9988

Thanks. Could the @node-projects/add-js-to-esm-modules be modified to produce less output? right now it's very chatty. Ideally it'd produce no output, or just a summary with the number of files/import statements modified and the run time.

Also, is it possible to add some unit tests to the source code of that module? To ensure that future version won't cause regressions that will possibly break the build of packages using it.

urish avatar Feb 03 '23 16:02 urish

will do some tests and be less chatty 😉 but will do it next week.

jogibear9988 avatar Feb 03 '23 17:02 jogibear9988

Thanks. Could the @node-projects/add-js-to-esm-modules be modified to produce less output? right now it's very chatty. Ideally it'd produce no output, or just a summary with the number of files/import statements modified and the run time.

Also, is it possible to add some unit tests to the source code of that module? To ensure that future version won't cause regressions that will possibly break the build of packages using it.

Good evening @urish, how about giving ts-add-js-extension a try? The strength of this package is that, it can also find whether you are importing/exporting something.js or something/index.js, and it can find whether you are importing/exporting .js or .mjs, you just have to specify the outDir for this package to work. outDir needs user input, because

  1. There can be multiple tsconfig"something".json
  2. This tool will run independent of tsc

(Heck, it can also run on JavaScript project if developers are lazy to specify the file extension)

Try it, it should be of great help as it covers a lot of cases

GervinFung avatar May 19 '23 08:05 GervinFung

@GervinFung congrats on your projects! This is not really a priority for me now, but I'll keep it in mind.

urish avatar May 21 '23 09:05 urish