LoginSignup
0
1

More than 5 years have passed since last update.

nuxt.config.jsでpug-loaderにoptionsを渡す

Posted at

やりたかったこと

有効だった書き方:ok_woman:

{
  build: {
    extend (config) {
      config.module.rules.forEach((rule)=> {
        if(rule.loader === 'vue-loader') {
          // vue-loaderのrule.options.templateから渡せる
          rule.options.template.basedir= path.resolve('templates')
        }
      })
    }
  }
}

ダメだった書き方:no_good:

{
  build: {
    extend (config) {
      // こう書いても動かない
      config.module.rules.push({
        test: /\.(pug)$/,
        loader: 'pug-loader',
        options: {
          basedir: path.resolve('templates')
        }
      })
    }
  }
}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1