Static GitHub Issues

[2885] How to allow ES6 imports in nuxt.config.js file?

prev: vuex store problem in layout
next: The best place to initialize logger (nuxt lifecycle)

I want to grab some data from a config file to use in nuxt.config.js, but it comes up with the SyntaxError: Unexpected token import error.

/assets/site-config.js (used throughout components as well)

export default {}

nuxt.config.js

import SITE from './assets/site-config'
module.exports = {}

I've tried to create a .babelrc to transform the imports to commonjs but it doesn't work.

.babelrc:

{
  "plugins": ["transform-es2015-modules-commonjs"]
}
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2507">#c2507</a>)</em></sub></div>