aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

built-in bundler cannot process .mjs third party files

swalters opened this issue · comments

The bundler wants to append .js to every file name. Can we get a fix so that it ignores this for .mjs extensions?

For now, I'm having to rename any .mjs files to .js to make it work.

It's in your local aurelia_project/aurelia.json field transpiler.fileExtension. Change it from ".js" to ".mjs" and try again.

BTW, with .cjs and .mjs file, it's required to use explicit import foo from "./foo.mjs";.

Implicit import foo from "./foo"; only works with the old .js for Nodejs https://nodejs.org/dist/latest-v18.x/docs/api/modules.html#all-together.

Sorry, not transpiler.fileExtension, that affects the aurelia_project/ files, not src/ files.

Update transpiler.source from "src/**/*.js" to "src/**/*.mjs".

Note you need to update all src/ files import to explicit import envirnoment from "./environment.mjs";.

One more thing, update aurelia_project/tasks/transpile.js from .pipe(rename('environment.js')) to .pipe(rename('environment.mjs')).

My bad. For 3rd party file, we will release a patch soon.

Please try aurelia-cli v3.0.2.

@3cp works great. Thanks so much for keeping Aurelia-cli up to date.