I cannot use Typescript 3.8 with type-only imports and exports
In one file export a type
// some-file.ts
export type Foo = 'bar'
In another file, import that type using the new type-only import/export syntax
import type { Foo } from './some-file'
Gatsby should build the site
There is an "unexpected token" error.
ERROR #98123 WEBPACK
Generating SSR bundle failed
I'm using WSL with Fish shell but we're also getting the issue in CI which is pure Ubuntu 18.
System:
OS: Linux 4.19 Ubuntu 16.04.4 LTS (Xenial Xerus)
CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Shell: 4.3.48 - /bin/bash
Binaries:
Node: 12.13.1 - ~/.config/nvm/12.13.1/bin/node
Yarn: 1.22.4 - /usr/bin/yarn
npm: 6.12.1 - ~/.config/nvm/12.13.1/bin/npm
Languages:
Python: 2.7.12 - /usr/bin/python
npmPackages:
gatsby: 2.20.3 => 2.20.3
gatsby-plugin-alias-imports: 1.0.5 => 1.0.5
gatsby-plugin-mdx: 1.1.1 => 1.1.1
gatsby-plugin-react-helmet: 3.2.1 => 3.2.1
gatsby-plugin-treat: 1.2.3 => 1.2.3
gatsby-plugin-typescript: 2.3.1 => 2.3.1
gatsby-remark-prismjs: 3.4.1 => 3.4.1
gatsby-source-filesystem: 2.2.2 => 2.2.2
This feature is supported Babel in v7.9.0 which looks to be the version that is installed by gatsby-plugin-typescript so I'm not sure why this isn't working.
> npm ls @babel/preset-typescript
└─┬ [email protected]
└── @babel/[email protected]
> npm ls @babel/core
└─┬ [email protected]
└── @babel/[email protected]
Hi @tom-sherman,
I was facing the same issue but was able to fix it using the following steps (using yarn in my project):
yarn.lockyarn add @babel/coreIt seems the yarn.lock contents were pointing @babel/core to <7.9, and this was also causing certain upgraded babel packages to complain about the missing @babel/core@^7.9 peer dependency.
Hope this works for you as well.
@tom-sherman Can you please confirm whether @tiagovtristao 's solution resolved your issue?
Hello!
I'll be closing this issue as there has been no activity for 2 months.
Thank you for using Gatsby! purple_heart
Most helpful comment
Hi @tom-sherman,
I was facing the same issue but was able to fix it using the following steps (using yarn in my project):
yarn.lockyarn add @babel/coreIt seems the
yarn.lockcontents were pointing @babel/core to <7.9, and this was also causing certain upgraded babel packages to complain about the missing @babel/core@^7.9 peer dependency.Hope this works for you as well.