Skip to content

Ignore weird Webpack imports that start with ! #178

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
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ export default ({
return true;
}

// Ignore weird Webpack imports that start with `!`.
if (path.node.source.value.startsWith('!')) {
return true;
}

if (stats.opts.exclude && getTargetResourcePath(path, stats).match(new RegExp(stats.opts.exclude))) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import './bar.css';

// It should just completely ignore weird imports such as these.
import icomoonCss from '!!raw!./icomoon.global.css';
import themeVariables from '!less-vars!./variables.global.css';

<div styleName="a"></div>;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.a {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import './bar.css';

// It should just completely ignore weird imports such as these.
import icomoonCss from '!!raw!./icomoon.global.css';
import themeVariables from '!less-vars!./variables.global.css';

<div className="bar__a"></div>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": [
[
"../../../../src",
{
"generateScopedName": "[name]__[local]"
}
]
]
}