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

Start With CommonJS Instead of AMD? #120

Open
julkue opened this issue Aug 25, 2017 · 1 comment
Open

Start With CommonJS Instead of AMD? #120

julkue opened this issue Aug 25, 2017 · 1 comment

Comments

@julkue
Copy link

julkue commented Aug 25, 2017

A plugin of mine – mark.js – needs the name mark.js in CommonJS environments, and markjs in RequireJS environments due to the fact that otherwise RequireJS will try to load a file mark.js directly instead of the plugin specified in the dependency path (Example of a working path naming).

Due to the fact that Webpack and others support both – AMD and CommonJS – it would be safer to name the CommonJS statement before the AMD statement. Because otherwise it would take the AMD statement which would be markjs in my above named examplen, and markjs isn't valid for CommonJS environments (because the node module name is mark.js).

I guess this is a common approach for JavaScript modules where the name is ending with .js.

@pherrymason
Copy link

pherrymason commented Nov 24, 2017

you can disable AMD for your file in webpack configuration:

loaders: [ { test: /myjsfile.js/, loader: 'imports?define=>false'} ]

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

No branches or pull requests

2 participants