ReferenceError: resolve is not defined (`ExtractTe

2019-07-14 04:13发布

Before ask this question I searched the SO, get the bellow related post: ReferenceError: resolve is not defined

But it is not fit my case, because mine is error on the webpack config, I don;t know why get this issue.

When I use the npm run build, I get the bellow error:

/Users/ldsole/Desktop/my-project/web/wx_backup/webpack.base.config.js:51
                use: ExtractTextPlugin.extract({
                                       ^

ReferenceError: resolve is not defined
    at Object.<anonymous> (/Users/luowensheng/Desktop/my-project/web/wx_backup/webpack.base.config.js:51:40)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/luowensheng/Desktop/my-project/web/wx_backup/webpack.prod.config.js:5:27)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wx_backup@1.0.0 build: `webpack --progress --hide-modules --config webpack.prod.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the wx_backup@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/lasdas/.npm/_logs/2018-04-08T05_51_10_773Z-debug.log

You see the npm ERR! This is probably not a problem with npm. There is likely additional logging output above., I don't know where why get the error.

My cause error code (webpack.base.config.js) is bellow:

  {
    test: /\.css$/,
    use: ExtractTextPlugin.extract({   // there is the error line.
      use: ['css-loader?minimize', 'autoprefixer-loader'],
      fallback: 'style-loader'
    })
  },

标签: npm webpack
0条回答
登录 后发表回答