Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

npm module is depended on SystemJs #8

Closed
samvloeberghs opened this issue Mar 8, 2016 · 8 comments
Closed

npm module is depended on SystemJs #8

samvloeberghs opened this issue Mar 8, 2016 · 8 comments

Comments

@samvloeberghs
Copy link
Contributor

The direct use of the npm module as explained is depending on SystemJS.
As I'm using Webpack this seems like unexpected behaviour and somewhat unfortunate design.

Can you please share your feedback on this @dougludlow ?
I'd be happy to use this, but for now I need to reference the src folder directly.

Grtz!

@dougludlow
Copy link
Owner

Sounds like you need a cjs, amd or umd version? I can add tasks that build those and place them in the bundles folder, much like how angular2 currently does.

@samvloeberghs
Copy link
Contributor Author

(imo)

Well, isn't there a more generic way? I'm comparing now with the ng2-translate module from @ocombe. With webpack I can just import it, no hassle.

https://github.com/ocombe/ng2-translate/blob/master/ng2-translate.ts

With SystemJs, you always need something extra, but I might be biased :)

@ocombe
Copy link

ocombe commented Mar 8, 2016

You can import SystemJS modules with webpack 2.
The ideal module is umd, but with typescript you can only make commonjs/systemjs/amd modules, which is why I use commonjs modules for ng2-translate, it's compatible with all build tools (systemjs, webpack, browserify, ...).

@dougludlow
Copy link
Owner

Looks like typescript does support umd now:
microsoft/TypeScript#2036
https://github.com/Microsoft/TypeScript/wiki/Compiler-Options

I can ship umd by default and leave my systemjs bundle intact. Not sure if that will break things for existing users. I've gotta test that. Also I haven't used webpack, but I should create a demo project that uses it.

@ocombe
Copy link

ocombe commented Mar 8, 2016

But doesn't it mean that you users have to use the last version of the typescript compiler to consume them ?

@dougludlow
Copy link
Owner

@ocombe I don't think it matters, it's just es5 at that point and should be the responsibility of the loader to actually consume it. Typescript itself only cares about the declaration files from what I understand.

@dougludlow
Copy link
Owner

Looks like commonjs is the most common. I'll go that route and bump the minor version.

@dougludlow
Copy link
Owner

@samvloeberghs as of v0.2.0, it's now uses commonjs as the module format.

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

No branches or pull requests

3 participants