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-typescript example build failing with Error: [BABEL] ..../pages/about.tsx:.overrides is not allowed in preset options #4467

Closed
lukebarton opened this issue May 24, 2018 · 9 comments

Comments

@lukebarton
Copy link
Contributor

lukebarton commented May 24, 2018

Examples bug report

Example name

with-typescript

Describe the bug

When I run yarn run build I get an error trace from babel

{ Error: (client) ./pages/about.tsx
Module build failed: Error: [BABEL] /Users/a_user/dev/next.js/examples/with-typescript/pages/about.tsx: .overrides is not allowed in preset options
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/validation/options.js:64:13
    at Array.forEach (<anonymous>)
    at validate (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/validation/options.js:62:21)
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/full.js:242:36
    at cachedFunction (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/caching.js:40:17)
    at loadPresetDescriptor (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/full.js:234:45)
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/full.js:58:19
    at Array.map (<anonymous>)
    at recurseDescriptors (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/full.js:56:36)
    at recurseDescriptors (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/full.js:87:27)
    at loadFullConfig (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/config/full.js:103:6)
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/@babel/core/lib/transform.js:26:33
    at process._tickCallback (internal/process/next_tick.js:61:11)
 @ multi ./pages/about.tsx
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/next/dist/server/build/index.js:141:31
    at runWithDependencies (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/MultiCompiler.js:154:4)
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/async/dist/async.js:1140:9
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/async/dist/async.js:1064:13)
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/async/dist/async.js:969:16
    at /Users/a_user/dev/next.js/examples/with-typescript/node_modules/async/dist/async.js:1137:13
    at runCompilers (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/MultiCompiler.js:96:47)
    at fn (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/MultiCompiler.js:101:6)
    at compiler.run (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/MultiCompiler.js:150:5)
    at emitRecords.err (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/Compiler.js:265:13)
    at Compiler.emitRecords (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/Compiler.js:371:38)
    at emitAssets.err (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/Compiler.js:258:10)
    at applyPluginsAsyncSeries1.err (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/Compiler.js:364:12)
    at next (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/Users/a_user/dev/next.js/examples/with-typescript/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Check out repo & yarn install in root
  2. Navigate to with-typescript example
  3. yarn install
  4. yarn run build

Minimal Fuss Repro(tm):

git clone git@github.com:zeit/next.js.git
cd ./next.js 
yarn install
cd ./examples/with-typescript
yarn install
yarn run build

Expected behavior

It should build

System information

  • OS: osx
  • Version of Next.js: 6.0.3

Additional context

I actually found this issue in my own project - it just stopped building.
I tried re-running previously passing builds (yarn.locked dependencies) and it now fails. I guess it's either a dependency that yarn can't control, or someone has overwritten a release version somewhere

@lukebarton lukebarton changed the title with-typescript example build failing with .overrides is not allowed in preset options with-typescript example build failing with Error: [BABEL] ......./pages/about.tsx:.overrides is not allowed in preset options May 24, 2018
@lukebarton lukebarton changed the title with-typescript example build failing with Error: [BABEL] ......./pages/about.tsx:.overrides is not allowed in preset options with-typescript example build failing with Error: [BABEL] ..../pages/about.tsx:.overrides is not allowed in preset options May 24, 2018
@lukebarton
Copy link
Contributor Author

So the issue lies with @zeit/next-typescript@1.0.0 which depends on @babel/preset-typescript@^7.0.0-beta.46 (note the ^) which is upgraded to @babel/preset-typescript@7.0.0-beta.48 which seems to be problematic.

@zeit/next-typescript has already been patched in the latest commit:
vercel/next-plugins@a4e770e
but no release has happened yet - hence the latest version of @zeit/next-typescript (1.0.0) is still pointing at the broken dependency @babel/preset-typescript@^7.0.0-beta.46 (note the ^)

Waiting on @timneutkens to release a new version of @zeit/next-typescript and then we can patch the with-typescript example dependency and then things should be good 👍

@deslee
Copy link

deslee commented May 25, 2018

Is there a workaround for this in the meantime?

@danlunde
Copy link

to your package.json add

"resolutions": {
  "@babel/preset-typescript": "7.0.0-beta.42"
},

@prevostc
Copy link

This solution did not worked for me as it seems that @zeit/next-typescript ships a build with node_modules included.

$ grep -Rl .overrides ./node_modules | grep -i babel | grep -i preset
./node_modules/@zeit/next-typescript/node_modules/@babel/preset-typescript/lib/index.js
./node_modules/@zeit/next-typescript/node_modules/@babel/preset-typescript/src/index.js

I still have the error Module build failed: Error: [BABEL] .../pages/_app.tsx: .overrides is not allowed in preset options

@timneutkens
Copy link
Member

@lukebarton I've just released it as @zeit/next-typescript@1.0.1

@prevostc
Copy link

I confirm that @zeit/next-typescript@1.0.1 worked for me. Thanks @timneutkens

@timneutkens
Copy link
Member

Feel free to send a PR for the example @prevostc 👍

@timneutkens
Copy link
Member

Fixed in #4472

@lkostrowski
Copy link

Hi, I just saw the same bug in @zeit/next-typescript": "^1.1.1 -> downgrade to 1.0.1 helps

@lock lock bot locked as resolved and limited conversation to collaborators Dec 22, 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

No branches or pull requests

6 participants