skip to Main Content

file a.js

import {test} from 'b.js'

file b.js

export {
  tester
}

There is no test module was export in b.js.
Webpack mode is production.
Webpack build result is:

WARNING in a.js
export ‘test’ (imported as ‘test’) was not found in b.js

How to turn the WARNING information into ERROR information?
I want to know which Webpack configuration controls this output result.
Thank you.

2

Answers


  1. Chosen as BEST ANSWER

    I find the configuration in module.

    module.exports = { module: { strictExportPresence: true, }, };


  2. change your webpack.config.js to

    const config = {
       stats: {
        errors: true,
        warnings: false
      }
    }
    

    edit: according to https://webpack.js.org/configuration/stats/
    try:

    module.exports = {
      //...
      stats: 'errors-only',
    };
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search