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

Add extra checks to the copyFiles feature #561

Merged
merged 1 commit into from
Jun 16, 2019

Conversation

Lyrkan
Copy link
Collaborator

@Lyrkan Lyrkan commented Apr 11, 2019

This PR adds some extra checks to make sure that files really match the pattern used in copyFiles(...) before the file-loader is called (closes #556).

For a full description of the issue see #556 (comment), but here is a TL;DR:

Currently, if you have a folder that contains a foo.js file and calls copyFile(...) with a pattern that excludes .js files, that file will still be copied.

This is caused by the resolve.extensions mechanism of Webpack that also applies to require.context(...) calls (on which this feature relies) and includes ./foo (without the extensions) to the list of files that should be imported.

@weaverryan
Copy link
Member

WOW! Another deep, difficult bug. Thank you @Lyrkan!

@weaverryan weaverryan merged commit eea91a6 into symfony:master Jun 16, 2019
weaverryan added a commit that referenced this pull request Jun 16, 2019
This PR was merged into the master branch.

Discussion
----------

Add extra checks to the copyFiles feature

This PR adds some extra checks to make sure that files *really* match the pattern used in `copyFiles(...)` before the `file-loader` is called (closes #556).

For a full description of the issue see #556 (comment), but here is a TL;DR:

Currently, if you have a folder that contains a `foo.js` file and calls `copyFile(...)` with a pattern that excludes `.js` files, that file will still be copied.

This is caused by the `resolve.extensions` mechanism of Webpack that also applies to `require.context(...)` calls (on which this feature relies) and includes `./foo` (without the extensions) to the list of files that should be imported.

Commits
-------

eea91a6 Add extra checks to the copyFiles feature
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 this pull request may close these issues.

Encore.copyFiles pattern ignores .js files
2 participants