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

How to use dynamic imports with a CDN #1230

Open
derweili opened this issue Jun 7, 2021 · 2 comments
Open

How to use dynamic imports with a CDN #1230

derweili opened this issue Jun 7, 2021 · 2 comments

Comments

@derweili
Copy link

derweili commented Jun 7, 2021

wpack.io uses the __wpackIoAppNameOutputPath variable to get the url of the dist folder as described here https://wpack.io/concepts/how-publicpath-works/

For using CDNs, this variable needs to be set to the CDNs URL instead of the WordPress URL.
The docs already mention this case:

For example, we could very much put all the files inside dist to a CDN, and change publicPath to https://cdn.example.com/path/to/asset/dir.

Unfortunately the docs don't tell how to change the variable to the CDN URL.

I checked the https://github.com/swashata/wp-webpack-script/issues/new repository as well as the https://github.com/swashata/wpackio-enqueue/ repo but I did not find a way to overwrite the __wpackIoAppNameOutputPath variable.

Is there a way to manually set or overwrite this variable? Did I miss something?

@swashata
Copy link
Owner

There isn't a way to do this right now. But I am happy for a PR to add this feature. Maybe through some environment variables?

@swashata
Copy link
Owner

Or better yet, we can filter the value from wpackio/enqueue, so that it can be set programmatically.

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