Vuepress: How i can add .babelrc file use plugin babel-plugin-import lazyload ui-component

Created on 30 Oct 2018  路  11Comments  路  Source: vuejs/vuepress


Feature request



What problem does this feature solve?

What does the proposed API look like?

How should this be implemented in your opinion?

Are you willing to work on this yourself?**

Most helpful comment

Thinks. u are nice and Helpful man.
I have solved the problem

  chainWebpack: (config, isServer) => {
    config.module
      .rule('js') // Find the rule.
      .use('babel-loader') // Find the loader
      .tap(options => Object.assign(options, { // Modifying options
        plugins: [
          ["import", {
            "libraryName": "ant-design-vue",
            "libraryDirectory": "es",
            "style": "css"
          }]
        ]
      }))
    }

All 11 comments

  config.module
    .rule('js') // Find the rule.
      .use('babel-loader') // Find the loader
      .tap(options => Object.assign(options, { // Modifying options
        plugins: ['babel-plugin-import']
      }))

Ref: webpack-chain > Config module rules uses> modifying options

// config.js

  chainWebpack: (config, isServer) => {
    config.module
    .rule('js') // Find the rule.
      .use('babel-loader') // Find the loader
      .tap(options => Object.assign(options, { // Modifying options
        plugins: ['babel-plugin-import']
      }))
  }

Error:
ERROR in ./node_modules/_@[email protected]@@vuepress/core/lib/app/clientEntry.js
Module build failed (from ./node_modules/[email protected]@babel-loader/lib/index.js):

Detailed error log?


BTW: please DON'T use issue to ask question next time.

where ask question ;)

Discord server (Recommended), forum, or StackOverflow聽馃檪

Discord server is Response timeout WTF GFW~

If you can't even get over the wall... I can't help you nothing.

Thinks. u are nice and Helpful man.
I have solved the problem

  chainWebpack: (config, isServer) => {
    config.module
      .rule('js') // Find the rule.
      .use('babel-loader') // Find the loader
      .tap(options => Object.assign(options, { // Modifying options
        plugins: [
          ["import", {
            "libraryName": "ant-design-vue",
            "libraryDirectory": "es",
            "style": "css"
          }]
        ]
      }))
    }

Cool, so we just forgot options for this plugin (I don't know and don鈥檛 use it). but you should know this is not very safe if the internal babel options has occupied the plugins option.

Have other good plan?
And why its not safe?

Thank you for your research on the configuration, this problem troubles me a lot.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alinnert picture alinnert  路  3Comments

tinchox5 picture tinchox5  路  3Comments

genedronek picture genedronek  路  3Comments

ynnelson picture ynnelson  路  3Comments

harryhorton picture harryhorton  路  3Comments