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

Dynamic Imports: Dynamic Origin Option (CORS) #11105

Merged
merged 3 commits into from
Oct 2, 2020
Merged

Conversation

leonardoventurini
Copy link
Member

Add the option for dynamic-imports to fetch from the current origin instead of the absolute URL.

@CLAassistant
Copy link

CLAassistant commented Jun 26, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@filipenevola filipenevola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I just suggested a small adjustment and also we need a PR against the docs documenting these options, ok? Link the Docs PR here as well.

packages/dynamic-import/client.js Outdated Show resolved Hide resolved
packages/dynamic-import/client.js Outdated Show resolved Hide resolved
Copy link
Contributor

@sebakerckhof sebakerckhof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Meteor supports browsers that don't support const & let and this package's code doesn't get transpiled. You should stick to var.

@filipenevola
Copy link
Collaborator

@leonardoventurini is this ready to be merged? If so please remove WIP label 😉

@leonardoventurini
Copy link
Member Author

@leonardoventurini is this ready to be merged? If so please remove WIP label

Sorry I completely forgot about this, I believe it is ready but I will double-check if I have anything pending.

@filipenevola filipenevola merged commit d3a1628 into devel Oct 2, 2020
@filipenevola filipenevola deleted the dynamic-imports-cors branch October 2, 2020 12:36
@rijk
Copy link

rijk commented Oct 21, 2020

This works like a charm. After 2 years, I can finally remove my dynamic-import monkeypatch. Thanks @leonardoventurini !

@filipenevola filipenevola added this to the Release 1.12 milestone Nov 11, 2020
mariogasparoni added a commit to mariogasparoni/meteor that referenced this pull request Oct 18, 2021
When setting "useLocationOrigin: true" and also using a root url like
ROOT_URL=http://host:port/mypath , dynamic-import will ignore
"mypath" when fetching for files to be imported, resulting in a 404 for these
files.

To bypass this problem, i changed the code to prepend the "mypath" to the
module's URL, before trying to fetch it.

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

Successfully merging this pull request may close these issues.

7 participants