Comments (12)
I have the same issue. I want big dependencies to be fetched from CDN while keeping my code inline.
The key is to modify the inlineSource
to only include sources that are local.
Here is how I fixed it:
new HtmlWebpackPlugin({
inlineSource: '^[^(//)]+\.(js|css)$' // exclude source with `//`
}),
new DynamicCdnWebpackPlugin(),
new HtmlWebpackInlineSourcePlugin(),
@njzjz I hope this is helpful.
from dynamic-cdn-webpack-plugin.
from dynamic-cdn-webpack-plugin.
@id0Sch Sorry for the delay, I don't think there is a real solution here as if you try to in-line the JS, you are loosing the benefit of this plugin
https://github.com/DustinJackson/html-webpack-inline-source-plugin#basic-usage has a inlineSource
options that should be used to not include url starting by https://unpkg.com/#/
I wonder if we can make the error more explicit
Maybe we should set source
to throw when called?
from dynamic-cdn-webpack-plugin.
Of course :)
"dynamic-cdn-webpack-plugin": "^4.0.0-rc.1",
"html-webpack-inline-source-plugin": "^0.0.10",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.5.0",
from dynamic-cdn-webpack-plugin.
I can't see any issue in inline-source that could cause this issue.
from dynamic-cdn-webpack-plugin.
Which version of the plugins are you using? Note that dynamic-cdn-webpack >= 4
only works on webpack >=4
from dynamic-cdn-webpack-plugin.
@aulisius do you have any idea what causes it? because for now I've hardcoded the react min bundle in my HTML and it's such a bad practice :\
from dynamic-cdn-webpack-plugin.
@id0Sch Can you confirm me that everything is working fine, without dynamic-cdn-webpack-plugin
I'm asking because html-webpack-inline-source-plugin
doesn't have test running webpack@4
and html-webpack-plugin@3
so it might be a bug on there side
from dynamic-cdn-webpack-plugin.
Bit busy with vacation. Will try to get to this tmrw. I think it might be something to do with ordering of plugins and in what order they access the HtmlWebpackPlugin
event hooks.
from dynamic-cdn-webpack-plugin.
Finally got around to creating a repro https://github.com/aulisius/dynamic-cdn-issue-44-repro/blob/master/webpack.config.js . Really sorry for the delay @id0Sch . Will get working soon.
from dynamic-cdn-webpack-plugin.
@aulisius It's fine :)
Let me know if you need anything else 👍
Thanks again!
from dynamic-cdn-webpack-plugin.
Any progress or advice to solve this issue? I met the same problem.
from dynamic-cdn-webpack-plugin.
Related Issues (20)
- One error occurred after adding dynamic-cdn-webpack-plugin HOT 5
- doesn't parse other libraries HOT 4
- not working with webpack externals parameter HOT 1
- Add `module-to-cdn` as dependency HOT 5
- [Propostion] New API to instantiate plugin for diff supported output plugin HOT 7
- Vendor code still in my bundle HOT 4
- Can't figure out a basic scenario working with my own CDN and packages HOT 4
- 99.9% of my packages could not be found, but they exist in CDN HOT 2
- Dependency issue with babel-runtime HOT 5
- Is there a way to configure script injections? HOT 1
- Optional and peer dependencies HOT 7
- [Bug] Module isn't auto loaded from CDN URL at runtime. Is it meant to be? HOT 1
- Missing dependencies HOT 3
- Manually script injections order. HOT 2
- Building project includes dependency even when dynamic-cdn-webpack-plugin is set up HOT 1
- feat: work with webpack-manifest-plugin
- Support with Next.JS HOT 4
- want to use dynamically inside monaco editor, so as the user writes imports it should be added in the index.html
- Webpack 5 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynamic-cdn-webpack-plugin.