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

Eslint error loading custom import #1451

Closed
FacundoGFlores opened this issue Jan 26, 2017 · 1 comment
Closed

Eslint error loading custom import #1451

FacundoGFlores opened this issue Jan 26, 2017 · 1 comment

Comments

@FacundoGFlores
Copy link

I am using the adal-angular package and algo expose library. The thing is I need to import the AuthenticationContext

var AuthenticationContext = require('expose?AuthenticationContext!adal-angular');

but create-react-app webpack can not compile it because there is a flag for handling this kind of things:

import/no-webpack-loader-syntax

inside the eslint-config-react-app.

So I had to change it to:

'import/no-webpack-loader-syntax': 'warn'

How can I prevent this behaviour not changing the node_module?

@gaearon
Copy link
Contributor

gaearon commented Jan 26, 2017

Create React App doesn't support Webpack loaders. If you eject, you can customize ESLint config any way you like (and replace our preset with any other preset you prefer).

I would, however, recommend using regular JS instead of webpack loaders. This code:

var AuthenticationContext = require('expose?AuthenticationContext!adal-angular');

is equivalent to this code:

var AuthenticationContext = require('adal-angular');
window.AuthenticationContext = AuthenticationContext;

Unlike the first one, it's not specific to Webpack.

@gaearon gaearon closed this as completed Jan 26, 2017
@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@gaearon @FacundoGFlores and others