Webpack.DefinePlugin and jshint are "undefined"

I am using webpack.DefinePlugin

to inject global constants as part of my build pipeline. However, jshint complains that the constant is "undefined".

From my webpack.config.js:

  plugins: [
    new webpack.DefinePlugin({
        __ALEX__: JSON.stringify('alex.com')
    }),

      

leads to:

WARNING in ./src/Main.js
jshint results in errors
  '__ALEX__' is not defined. @ line 12 char 30
      lock: new Thing(__ALEX__)

      

What is the correct way for jshint to step through the code after entering the constants?

+3


source to share


1 answer


Add the following to .eslintrc

{
    "globals": {
        "__ALEX__": true
    },
    "parser": "babel-eslint",
    "parserOptions": {
      "sourceType": "module",
      "allowImportExportEverywhere": true
    }
}

      



No fields added parser

and parsterOptions

I get weird pre-ECMA Script 16 errors.

0


source







All Articles