Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with-universal-configuration example errors #4623

Closed
michaeljonathanblack opened this issue Jun 17, 2018 · 3 comments · Fixed by #4624
Closed

with-universal-configuration example errors #4623

michaeljonathanblack opened this issue Jun 17, 2018 · 3 comments · Fixed by #4624

Comments

@michaeljonathanblack
Copy link

Examples bug report

https://github.com/zeit/next.js/tree/canary/examples/with-universal-configuration

Example name

with-universal-configuration

Describe the bug

mherold-mac:with-universal-configuration-app mherold$ yarn dev
yarn run v1.7.0
$ next
Error: .plugins[0][1] must be an object, false, or undefined
    at assertPluginItem (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/validation/option-assertions.js:157:15)
    at /Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/validation/option-assertions.js:134:14
    at Array.forEach (<anonymous>)
    at assertPluginList (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/validation/option-assertions.js:133:9)
    at /Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/validation/options.js:84:20
    at Array.forEach (<anonymous>)
    at validate (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/validation/options.js:62:21)
    at /Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/config-chain.js:141:36
    at cachedFunction (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/caching.js:40:17)
    at init (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/config-chain.js:122:12)
    at /Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/config-chain.js:206:17
    at buildRootChain (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/config-chain.js:85:20)
    at loadPrivatePartialConfig (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/partial.js:41:53)
    at loadPartialConfig (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/@babel/core/lib/config/partial.js:66:16)
    at babelConfig (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/next/dist/server/build/webpack.js:88:57)
    at _callee2$ (/Users/mherold/git/temp/with-universal-configuration-app/node_modules/next/dist/server/build/webpack.js:164:34)
error Command failed with exit code 1.
@michaeljonathanblack
Copy link
Author

Irrespective of this error, I'd love an alternate path to defining our own environment variables at build time.

@teleginzhenya
Copy link
Contributor

You should use commonjs modules in .babelrc.js. Don't forget to update babel-plugin-transform-define to 1.3.0

// .babelrc.js
const env = require("./env-config.js");

module.exports = {
  presets: ["next/babel"],
  plugins: [["transform-define", env]]
};

I'll make PR on this issue :)

@michaeljonathanblack
Copy link
Author

You're lovely people, thank you!

lependu pushed a commit to lependu/next.js that referenced this issue Jun 19, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jun 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants