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

Bug/incorrect manifest keys are produced #810

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions fixtures/images/symfony-logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions fixtures/js/import_svg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../images/symfony-logo.svg';
46 changes: 45 additions & 1 deletion test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ describe('Functional tests using webpack', function() {
});

describe('Basic scenarios.', () => {
it('Generates a correct manifest when images are imported from a js file', (done) => {
const config = createWebpackConfig('web/build', 'production');
config.addEntry('svg', './js/import_svg');
config.setPublicPath('/build');

testSetup.runWebpack(config, (webpackAssert) => {
webpackAssert.assertManifestPath(
'build/images/symfony-logo.svg',
'/build/images/symfony-logo.579acd4f.svg'
);

done();
});
});

it('Builds a few simple entries file + manifest.json', (done) => {
const config = createWebpackConfig('web/build', 'dev');
Expand Down Expand Up @@ -2124,6 +2138,7 @@ module.exports = {
'main.js',
'manifest.json',
'symfony_logo.png',
'symfony-logo.svg',
'symfony_logo_alt.png',
]);

Expand All @@ -2132,6 +2147,11 @@ module.exports = {
'/build/main.js'
);

webpackAssert.assertManifestPath(
'build/symfony-logo.svg',
'/build/symfony-logo.svg'
);

webpackAssert.assertManifestPath(
'build/symfony_logo.png',
'/build/symfony_logo.png'
Expand Down Expand Up @@ -2171,6 +2191,7 @@ module.exports = {

expect(path.join(config.outputPath, 'assets')).to.be.a.directory()
.with.files([
'symfony-logo.svg',
'symfony_logo.png',
'symfony_logo_alt.png',
'Roboto.woff2',
Expand All @@ -2181,6 +2202,11 @@ module.exports = {
'/build/main.js'
);

webpackAssert.assertManifestPath(
'build/assets/symfony-logo.svg',
'/build/assets/symfony-logo.svg'
);

webpackAssert.assertManifestPath(
'build/assets/symfony_logo.png',
'/build/assets/symfony_logo.png'
Expand Down Expand Up @@ -2221,6 +2247,7 @@ module.exports = {

expect(path.join(config.outputPath, 'images')).to.be.a.directory()
.with.files([
'symfony-logo.579acd4f.svg',
'symfony_logo.91beba37.png',
'symfony_logo_alt.f880ba14.png',
]);
Expand All @@ -2235,6 +2262,11 @@ module.exports = {
'/build/main.js'
);

webpackAssert.assertManifestPath(
'build/images/symfony-logo.svg',
'/build/images/symfony-logo.579acd4f.svg'
);

webpackAssert.assertManifestPath(
'build/images/symfony_logo.png',
'/build/images/symfony_logo.91beba37.png'
Expand Down Expand Up @@ -2314,13 +2346,14 @@ module.exports = {
'runtime.518d4a5c.js',
'main.78f7d83e.js',
'manifest.json',
'symfony-logo.579acd4f.svg',
'symfony_logo.91beba37.png',
'symfony_logo_alt.f880ba14.png',
]);

webpackAssert.assertManifestPath(
'build/main.js',
'/build/main.78f7d83e.js'
'/build/main.31fd3788.js'
);
}

Expand All @@ -2329,6 +2362,11 @@ module.exports = {
'Roboto.woff2',
]);

webpackAssert.assertManifestPath(
'build/symfony-logo.svg',
'/build/symfony-logo.579acd4f.svg'
);

webpackAssert.assertManifestPath(
'build/symfony_logo.png',
'/build/symfony_logo.91beba37.png'
Expand Down Expand Up @@ -2407,6 +2445,7 @@ module.exports = {

expect(path.join(config.outputPath, 'images')).to.be.a.directory()
.with.files([
'symfony-logo.579acd4f.svg',
'symfony_logo.91beba37.png',
'symfony_logo_alt.f880ba14.png',
]);
Expand All @@ -2421,6 +2460,11 @@ module.exports = {
'/build/main.js'
);

webpackAssert.assertManifestPath(
'build/images/symfony-logo.svg',
'/build/images/symfony-logo.579acd4f.svg'
);

webpackAssert.assertManifestPath(
'build/images/symfony_logo.png',
'/build/images/symfony_logo.91beba37.png'
Expand Down