3

QUESTION: How can I configure Webpack to treat warnings as errors when using Vue-Loader?

BACKGROUND: My Webpack configuration is using Vue-Loader to build an app that uses Vue single-file components. I'd like the build to fail and produce an error when warnings such as the below occur:

WARNING in ./{SOME_COMPONENT}.vue ({BOILERPLATE_PATHS}) 107:6-34
"export '{SOME_FUNCTION}' was not found in '../../{SOME_MODULE}'

The warning above surfaces when I'm trying to import a "named" export from a module that only contains a default export.

I've reviewed the docs at the links below, but I don't see anything that would allow me to achieve my goal:

For non-watch builds, I suppose it would be possible to parse the build output for warnings using a regex and trigger an action that could fail a CI build, but I'd ideally like to be able to fail watch builds as well. Maybe there's a post-build Webpack hook or something? I'm open to suggestions.


My current Vue-Loader/Webpack config is basically:

{
    test: /\.vue$/,
    loader: 'vue-loader',
    include: [
        path.resolve(__dirname, './SomeFolder/')
    ],
    exclude: [
       path.resolve(__dirname, './node_modules/'),
       path.resolve(__dirname, './SomeFolder/Tests/')
    ],
},
derekbaker783
  • 8,109
  • 4
  • 36
  • 50

0 Answers0