Code Monkey home page Code Monkey logo

Comments (12)

cheungpat avatar cheungpat commented on June 8, 2024 3

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.

id0Sch avatar id0Sch commented on June 8, 2024 2

from dynamic-cdn-webpack-plugin.

mastilver avatar mastilver commented on June 8, 2024 2

@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.

id0Sch avatar id0Sch commented on June 8, 2024 1

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.

id0Sch avatar id0Sch commented on June 8, 2024 1

I can't see any issue in inline-source that could cause this issue.

from dynamic-cdn-webpack-plugin.

aulisius avatar aulisius commented on June 8, 2024

Which version of the plugins are you using? Note that dynamic-cdn-webpack >= 4 only works on webpack >=4

from dynamic-cdn-webpack-plugin.

id0Sch avatar id0Sch commented on June 8, 2024

@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.

mastilver avatar mastilver commented on June 8, 2024

@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.

aulisius avatar aulisius commented on June 8, 2024

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.

aulisius avatar aulisius commented on June 8, 2024

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.

id0Sch avatar id0Sch commented on June 8, 2024

@aulisius It's fine :)
Let me know if you need anything else 👍
Thanks again!

from dynamic-cdn-webpack-plugin.

njzjz avatar njzjz commented on June 8, 2024

Any progress or advice to solve this issue? I met the same problem.

from dynamic-cdn-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.