Skip to content
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

Apply new mjs file extension and remove imports from dependencies #69

Open
ghost opened this issue Sep 26, 2017 · 1 comment
Open

Apply new mjs file extension and remove imports from dependencies #69

ghost opened this issue Sep 26, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 26, 2017

I'm using Node 8.5's new es module import to run a SPA application in SSR mode in Node. In this case it's very useful to have the sourcecode for Node running without the need to transpile it. The implementation for Node dictates that the file extension for modules is '.mjs'. By renaming index.js to index.mjs, Node can easily import and use the file. Transpilers like rollup can handle different extensions without any problems, so it shouldn't be a problem for legacy builds.

Also, I'm not sure if that's due to my rollup settings, but when I do an import like:
import {HttpAdapter as DSHttpAdapter} from 'js-data-http'

Rollup will include js-data twice(once from js-data-http and once from js-data-adapter). Wouldn't it be much easier to keep the bundle size small, by assuming a global like:
const {utils} = JSData

Instead of import { utils } from 'js-data'

Using an external option for js-data in rollup seems a bit cumbersome when js-data is included in the same vendor.js file. I add a pull request just as demo(what works for me). Please let me know if I can help out. The same thing applies for js-data-adapter.

@crobinson42
Copy link
Member

@jvanveen How is that fork working out for you? Do you have a public repo we can see it in action?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant