question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ES-Lint Rule "import/no-webpack-loader-syntax" please deactivate

See original GitHub issue

I’m trying to use CRA as a starting Point for https://github.com/FormidableLabs/spectacle

Works fine expect the codepane - to show code you need the webpack “raw loader” witch is called like so source={require("raw!../assets/deck.example")}

Since I cant edit the webpack config in CRA - it would be great if this rule “import/no-webpack-loader-syntax” would be just a waring - no error!

Thanks for your help!

And keep an the realy good work - soooo great!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

30reactions
dtinthcommented, Jul 14, 2017

For people who might stumble on this issue, here’s a workaround (make sure you understand the implication of doing this): Put this in the file you want to make an exception:

/* eslint import/no-webpack-loader-syntax: off */
6reactions
colinrobertbrookscommented, Aug 31, 2017

If you ran create-react-app my-presentation --scripts-version spectacle-scripts to generate a Spectacle project, here’s how you pass a code sample to the CodePane component without raw-loader:

Add the following to index.html (the Prism library handles code syntax highlighting):

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/prism/1.3.0/themes/prism-tomorrow.css">
<script src="https://cdn.jsdelivr.net/prism/1.3.0/prism.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/prism/1.3.0/components/prism-jsx.min.js" type="text/javascript"></script>

Use an ES6 module with a .js extension for the code sample file (not .example):

export default `
   // code here
`;

Use the CodePane in JSX like this (note the curly braces):

{<CodePane
   lang="javascript"
   source={require("./code_sample.js").default}
/>}
Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack 2 expected '!' error using with import - Stack Overflow
Using inline loaders is generally not recommended and the ESLint rule import/no-webpack-loader-syntax exists to warn you from doing this.
Read more >
import/no-webpack-loader-syntax - PLMlab
This syntax is non-standard, so it couples the code to Webpack. The recommended way to specify Webpack loader configuration is in a Webpack ......
Read more >
eslint/eslint - Gitter
Hi, I'm new to ESLint, and I want ESLint to add missing curly braces via API automatically (when calling the lintFiles() or lintText()...
Read more >
eslint-loader - webpack
NoEmitOnErrorsPlugin is now automatically enabled in webpack 4, when mode is either unset, or set to production. So even ESLint warnings will fail...
Read more >
eslint-plugin-import - npm
Start using eslint-plugin-import in your project by running `npm i ... Forbid webpack loader syntax in imports ( no-webpack-loader-syntax ) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found