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

[bugfix] webpack-cli init loader's test regex #1309

Merged
merged 1 commit into from
Mar 11, 2020
Merged

[bugfix] webpack-cli init loader's test regex #1309

merged 1 commit into from
Mar 11, 2020

Conversation

CroMarmot
Copy link
Contributor

@CroMarmot CroMarmot commented Mar 10, 2020

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?
no

If relevant, did you update the documentation?
no

Summary

Fixed the regular expression of loader's test field in webpack.config.js generated by webpack-cli init

Does this PR introduce a breaking change?
no

Other information

the regex should be \.jsx?$ or \.(js|jsx)$, the original string should be "/\\.(js|jsx)$/" instead of /.(js|jsx)$/

the same with "/.(ts|tsx)?$/" -> "/\\.(ts|tsx)$/"

/.(ts|tsx)?$/.test("anystring") === true
/.(ts|tsx)$/.test("anystringts") === true
/\.(ts|tsx)$/.test("anystring.ts") === true

@CroMarmot CroMarmot requested a review from a team as a code owner March 10, 2020 12:18
@jsf-clabot
Copy link

jsf-clabot commented Mar 10, 2020

CLA assistant check
All committers have signed the CLA.

@ghost
Copy link

ghost commented Mar 10, 2020

There were the following issues with this Pull Request

  • Commit: 4d6d022
    • ✖ message may not be empty
    • ✖ type may not be empty

You may need to change the commit messages to comply with the repository contributing guidelines.


🤖 This comment was generated by commitlint[bot]. Please report issues here.

Happy coding!

@webpack-bot
Copy link

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@ematipico
Copy link
Contributor

Hi! Thank you for your contribution! Could you sign the license agreement please?

@ematipico ematipico merged commit 62e0314 into webpack:next Mar 11, 2020
@rkaw92
Copy link

rkaw92 commented Mar 24, 2020

Leaving this here for posterity: if you, like me, are having problems where require('./style.css') from a TypeScript file seems to do absolutely nothing where it should invoke style-loader, it may be caused by this.

Apparently, Webpack configs generated by a buggy version of this init tool where both ts-loader and style-loader are active may cause ts-loader to override loading of .css files (due to the RegExp issue described above), and cause styles to not appear.

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

Successfully merging this pull request may close these issues.

9 participants