-
-
Notifications
You must be signed in to change notification settings - Fork 751
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
ESM Support #2423
Comments
Is this available without a flag in all currently supported NodeJS versions? I was thinking of adding it as another build but if that is the case I'd much rather make it the default that's published. |
Yep, Node 10 which doesn't support ESM was already dropped as end-of-life. So, the answer is yes. But, not by default, users have to opt in via |
Sorry, I glossed over this part. So the answer is no I guess. So adding it as another build might be better for now. But you can configure |
I'd find this very useful too. Starting a new app but don't want to use typescript for it. I would like to use import/export though so it would be nice to be able to generate the app as an esm project. |
This will be the default in v5 and the new CLI currently under development in #2425 |
Awesome! Thanks for the info |
@daffl Can you please add Then we can import feathers client using es modules from CDN. Ex. <script type="module">
import feathers from 'https://unpkg.com/@feathersjs/[email protected]/dist/feathers.esm.js'
const app = feathers()
</script> WorkaroundCurrently the index.js file is of type
export default async (url, module = {exports:{}}) =>
(Function('module', 'exports', await (await fetch(url)).text()).call(module, module, module.exports), module).exports
<script type="module">
import loadUMD from './umdloader.js'
loadUMD('https://unpkg.com/@feathersjs/[email protected]/dist/feathers.esm.js').then(feathers => {
const app = feathers()
})
</script> |
I also believe you should add an |
We have been trying to do this in #2665 for the Feathers core packages but so far have not gotten it to work. |
Looks like it is @feathersjs/[email protected] which are causing the problem:
|
Now that most of the libraries are already in ESM, I think it's time Feathers also release an ESM build. It should be pretty easy just to change the module from
commonjs
toES2020
a few other changes mentioned in https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c.feathers/tsconfig.json
Line 5 in e013f98
The advantage is then I could just do
instead of
The text was updated successfully, but these errors were encountered: