LoginSignup
3
1

More than 3 years have passed since last update.

Nuxt.js で lodash-es を使う

Posted at

Nuxt.js で lodash の ES モジュール版 (lodash-es) を使う場合、nuxt.config.js の build.transpile オプションを設定する必要がある。
( https://stackoverflow.com/questions/53081769/syntaxerror-unexpected-token-export-when-using-lodash-with-nuxt の回答より)

nuxt.config.js
export default {
  ...
  build: {
    transpile: [
      'lodash-es'
    ],
    ...
  }
}

これで .vue ファイルなどで import できるようになる。

※ Vue.js で lodash-es を使った時は何事もなく使えたので、この辺り Vue と Nuxt で違いがあるようだ。

3
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
3
1