// webpack 报错 (node:45948) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56 parseQuery() will be replaced with getOptions() in the next major version of loader-utils. // vue报错 // 略过一些重复的报错 warning in ./src/pages/List.vue (Emitted value instead of an instance of Error) the "scope" attribute for scoped slots have been deprecated and replaced by "slot-scope" since 2.5. The new "slot-scope" attribute can also be used on plain elements in addition to <template> to denote scoped slots. @ ./src/pages/List.vue 9:2-305 @ ./src/router/index.js @ ./src/main.js复制代码
The deprecation warning is for webpack loader authors, because calling parseQuery with a non-string value can have bad side-effects (see below). If you're a webpack user, you can set process.traceDeprecation = true in your webpack.config.js to find out which loader is causing this deprecation warning. Please file an issue in the loader's repository.
Starting with webpack 2, it is also possible to pass an object reference from the webpack.config.js to the loader. This is a lot more straight-forward and it allows the use of non-stringifyable values like functions.
For compatibility reasons, this object is still read from the loader context via this.query. Thus, this.query can either be the options object from the webpack.config.js or an actual loader query string. The current implementation of parseQuery just returns this.query if it's not a string.
Unfortunately, this leads to a situation where the loader re-uses the options object across multiple loader invocations. This can be a problem if the loader modifies the object (for instance, to add sane defaults). See jtangelder/sass-loader#368 (comment).
Modifying the object was totally fine with webpack 1 since this.query was always a string. Thus, parseQuery would always return a fresh object.
Starting with the next major version of loader-utils, we will unify the way of reading the loader options:
We will remove parseQuery and getLoaderConfig
We will add getOptions as the only way to get the loader options. It will look like this:
const options = loaderUtils.getOptions(this);复制代码
The returned options object is read-only, you should not modify it. This is because getOptions can not make assumptions on how to clone the object correctly.
Now uses ES modules internally to take advantage of webpack 3 scope hoisting. This should result in smaller bundle sizes.
Now uses PostCSS@6.
Breaking Changes
The esModule option is now true by default, because this is necessary for ES-module-based scope hoisting to work. This means the export from a *.vue file is now an ES module by default, so async components via dynamic import like this will break:
const Foo = () => import('./Foo.vue')复制代码
Note: the above can continue to work with Vue 2.4 + vue-router 2.7, which will automatically resolve ES modules' default exports when dealing with async components. In earlier versions of Vue and vue-router you will have to do this:
Alternatively, you can turn off the new behavior by explicitly using esModule: false in vue-loader options.Similarly, old CommonJS-style requires will also need to be updated:
// before const Foo = require('./Foo.vue') // after const Foo = require('./Foo.vue').default复制代码
PostCSS 6 might break old PostCSS plugins that haven't been updated to work with it yet.
文档里说的很清楚了
可以在 vue-loader 的 options 里通过 esModule: false 配置来关闭 ES 模块