Skip to content

import/no-webpack-loader-syntax Restriction

What it does

Forbids using Webpack loader syntax directly in import or require statements.

Why is this bad?

This loader syntax is non-standard, so it couples the code to Webpack. The recommended way to specify Webpack loader configuration is in a Webpack configuration file.

Examples

Examples of incorrect code for this rule:

javascript
import myModule from "my-loader!my-module";
import theme from "style!css!./theme.css";

var myModule = require("my-loader!./my-module");
var theme = require("style!css!./theme.css");

Examples of correct code for this rule:

javascript
import myModule from "./my-module";
import theme from "./theme.css";

var myModule = require("./my-module");
var theme = require("./theme.css");

References

Released under the MIT License.