Tuesday, 2 May 2017

share definePlugin constants across dependencies

I built 3 webpack projects with the following dependency:

  1. Master Project.
    1. Common Lib.
    2. Security Lib.

Common and Security packages are defined as webpack library and inserted as dependencies on master's package.json. I need to setup my dependent projects to take the global values I set at master's webpack config with DefinePlugin which I configure depending on the environment through an npm script.

plugins.push(new webpack.DefinePlugin({
    requireSsl:true,
    api_url:"https://some.url"
}))

So, anytime I build my master project all my dependencies have those constants aligned.



via Anyul Rivas

No comments:

Post a Comment