Skip to content

How to manually add entries to manifest.json? #140

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

Closed
havvg opened this issue Aug 16, 2017 · 2 comments · Fixed by #164
Closed

How to manually add entries to manifest.json? #140

havvg opened this issue Aug 16, 2017 · 2 comments · Fixed by #164

Comments

@havvg
Copy link

havvg commented Aug 16, 2017

Hi there,

I've got somewhat legacy (huge dumped JS arrays) code. Without Encore I can do this:

new ConcatPlugin({
    uglify: true,
    useHash: true,
    sourceMap: false,
    fileName: 'shipdev-data.js',
    filesToConcat: ['./frontend/shipdev/data/modules.js', './frontend/shipdev/data/ships.js']
})

I would like to keep it this way for now, because it works. I tried using addEntry but this runs for ages (I cancelled after 10minutes). Now using Encore, I am adding this:

addPlugin(new ConcatPlugin({
    uglify: true,
    useHash: true,
    sourceMap: false,
    fileName: 'shipdev-data.js',
    filesToConcat: ['./frontend/shipdev/data/modules.js', './frontend/shipdev/data/ships.js']
}))

Which works fine to the point that the file is available and contains the content as it should. Now I would like to have this entry being added to the manifest.json. Is there an elegant way with Encore?

My current workaround is just defining useHash: false, which works for asset('shipdev-data.js') with framework.assets.base_path configured.

@weaverryan
Copy link
Member

Hey @havvg!

Hmm. This initially sounds like a bug or missing feature in the ManifestPlugin. In theory, it would see this newly output file and use it in the manifest. There's actually a similar issue when using the CopyWebpackPlugin: copied assets aren't in the manifest. In this situation, the ManifrstPlugin guys would like to fix it.

So I believe the answer right now is no. We'd need to possibly open this issue upstream.

Btw, if this .js file is just data, one alternative is to convert it into a JSON file. Then require that from an entry .js file. Webpack is able to load JSON, and it should be fast. It's possible it still may be too slow during uglification or something, but might be worth a try :).

Cheers!

@mastilver
Copy link

Will probably be solved by: shellscape/webpack-manifest-plugin#75

weaverryan added a commit that referenced this issue Apr 14, 2018
This PR was squashed before being merged into the master branch (closes #164).

Discussion
----------

Trying out the new webpack-manifest-plugin

This is not ready to be merged yet... as we should wait for a stable release. But, let's see if the tests pass :). We originally "forked" this library internally due to 2 issues, both of which should have been fixed in version 2 of the library.

Should fix #140.

TODOS:

- Remove the old `webpack-manifest-plugin.js` file entirely and update paths to require the actual library instead of this

- Stop passing the `publicPath` option to the plugin, as this is not supported anymore (I believe it's just being ignored right now)

Commits
-------

6657a78 using the module directly and removing publicPath option, which is gone
9f7a866 Trying out the new webpack-manifest-plugin
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

Successfully merging a pull request may close this issue.

3 participants