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

Write to .js instead of .json #24

Open
noahgrant opened this issue Jan 14, 2017 · 4 comments
Open

Write to .js instead of .json #24

noahgrant opened this issue Jan 14, 2017 · 4 comments

Comments

@noahgrant
Copy link

I love using this plugin to keep my core chunk from changing anytime any of the child chunks change. However, I feel like there's a gap between easy plug-and-play:

  1. This plugin writes the filenames/hashes to a json file and tells webpack to look for them in the global manifestVariable variable.
  2. Webpack is built and looks for these files/hashes in the global manifestVariable variable.

...but we still have to manually attach the json to the global manifestVariable variable ourselves.

It'd be nice to have an option where instead of printing out the json to a .json file, it prints it out to .js file as:

window.<manifestVariable> = <parsedJSON>;

Then all we would need to do is attach the script tag or inline it. Would that make sense?

@jouni-kantola
Copy link

To handle the specific use case you're after I created this https://github.com/jouni-kantola/inline-chunk-manifest-html-webpack-plugin, @noahgrant. It consumes the webpack manifest JSON file when building (note issue: #26).

Now that I'm looking around I noticed there are a couple of PR's for chunk-manifest-webpack-plugin also addressing this: #15 and #18

@noahgrant
Copy link
Author

Thanks @jouni-kantola, but what I actually want is the flexibility to write the result to file instead of assuming that I want to inline it. I've forked this repo and made that functionality for myself, but I haven't seen maintainers very responsive here, so I haven't opened a PR yet.

@noahgrant
Copy link
Author

Hi! Just following up; any interest here for adding this? I can cut a PR...

@iamdavidjackson
Copy link

I would like this too! I've opened a PR here: #37 which makes the emitted file prepend window.manifestVariable to the file so you can drop it into any page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants