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

Warns when the user is using special webpack syntax #736

Closed
wants to merge 5 commits into from

Conversation

rogeriochaves
Copy link

This should solve #733

I haven't tested it yet as I'm in a hurry, so if you can, please do (:

Instead of throwing an error I am showing a warning because I didn't want to block users to use a feature just because it might break in the future, and force them to eject just because of a minor plugin.

@ghost
Copy link

ghost commented Sep 24, 2016

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@ghost ghost added the CLA Signed label Sep 24, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 24, 2016

I would like this to be a hard error. It was never officially supported and doesn't work with some officially supported features like testing. If somebody uses this in an open source React example and then we break this feature, people using that example will be utterly confused, as happened many times before with e.g. Babel. There won't be any "migration step" in the changelog for them because this feature is unsupported. So we'd rather disable it completely.

@ghost
Copy link

ghost commented Sep 24, 2016

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@rogeriochaves
Copy link
Author

@gaearon okay, changed it, thanks for the explanation 👍

still, haven't really tested my implementation though

@ghost ghost added the CLA Signed label Sep 25, 2016
@rogeriochaves
Copy link
Author

rogeriochaves commented Sep 25, 2016

apparently create-react-app uses this syntax in quite a few places and the plugin is also evaluating third-party dependencies, as it can be seen on travis log

compiler.plugin('normal-module-factory', (normalModuleFactory) => {
normalModuleFactory.plugin('before-resolve', (data, callback) => {
let error = null;
if (data.request.match(/^-?!!?/)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be best to use the exact same regexps as webpack uses for this (which I believe can be found here https://github.com/webpack/webpack/blob/master/lib/NormalModuleFactory.js#L86)

@fson
Copy link
Contributor

fson commented Sep 25, 2016

The reason why the build is failing is because webpack uses this syntax internally, so we can't fully block it without breaking how webpack works.

I think it would be easiest to add this as an ESLint rule, so it only forbids using this feature in user code: import-js/eslint-plugin-import#586

@gaearon
Copy link
Contributor

gaearon commented Sep 30, 2016

Sorry for the wasted effort! Indeed a lint rule seems better in this case.
I’ll close this as we wait for the new eslint-plugin-import release.

@gaearon gaearon closed this Sep 30, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants