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

Handle case where another AMD loader (e.g. requirejs) is already loaded. #288

Merged
merged 4 commits into from
Jun 18, 2020

Conversation

chuckdumont
Copy link
Collaborator

No description provided.

@GordonSmith
Copy link
Contributor

@chuckdumont here is another use case you should test for:

var reqOne = require.config({
    context: "version1",
    baseUrl: './'
});

reqOne (["./dist/index"], function (dgridShim) {
    console.log(dgridShim.BUILD_VERSION);
});

@chuckdumont chuckdumont merged commit 5e8922e into OpenNTF:master Jun 18, 2020
@chuckdumont
Copy link
Collaborator Author

@GordonSmith - The use case you present isn't supported. Dynamically modifying a config at runtime is not something that webpack supports, so dojo-webpack-plugin can't do it either. Note that webpack is loading the modules here, not Dojo. In fact, the module loading machinery in dojo.js is disabled by has conditions and optimized out. Only the code for resolving module names is retained. Since webpack maps module names to bundled module ids at build time, changing the mappings, or adding new mappings, at runtime is something that cannot be done.

@GordonSmith
Copy link
Contributor

That test was intended to be used from the consumer side, I wasn't implying that you should support it inside dojo code!

@chuckdumont
Copy link
Collaborator Author

I guess I need more context then. require.config() is an AMD feature that allows client code to dynamically update the loader config at runtime for the subsequent loading of modules. Translating that to webpack, it would be like trying to update webpack.config.js at runtime to affect the subsequent loading of modules by webpack. It's just not something that is supported.

@chuckdumont
Copy link
Collaborator Author

Fixes #287

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0002%) to 99.622% when pulling c1ba099 on chuckdumont:work into 980a30d on OpenNTF:master.

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

Successfully merging this pull request may close these issues.

3 participants