Добавить плагин в конфигурацию цепочки веб-пакетов - PullRequest
0 голосов
/ 05 марта 2020

Я пытаюсь добавить @ babel / plugin-transform-classes в конфигурацию веб-пакета. Я установил модуль NPM и попытался активировать его, используя следующую конфигурацию:

const transform = require.resolve("@babel/plugin-transform-classes")
module.exports = {
    chainWebpack: config => {
        config.module
            .rule('vue')
            .use('vue-loader')
            .loader('vue-loader')
            .tap(options => {
                options['transformAssetUrls'] = {
                    img: 'src',
                    image: 'xlink:href'
                }

                return options
            });
        config.plugin('transform')
            .use(transform, [])
    }
}

Это приводит к следующей ошибке:

error WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
         - configuration.plugins[13] misses the property 'apply'.
           function
           -> The run point of the plugin, required method.

Как мне изменить вышеприведенное правильно загрузить плагин?

...