Closed martpie closed 2 years ago
I'm really waiting for that. Using experimental SWC option on current Next canary versions, with:
experimental: {
swcMinify: true,
swcLoader: true
}
seems to work till next-transpile-module module is approached:
|
101 | delete<SRT, QPT extends DefaultQueryParametersType = undefined, BPT = undefined>(
| ^
error: Expected ',', got '< (jsx tag start)
so basically it does not treat this file as typescript one. However typescript detection in next-swc-loader
seems to work ok - https://github.com/vercel/next.js/blob/00431087d7ce2126bc819472cb3b71dbaefd46f7/packages/next/build/webpack/loaders/next-swc-loader.js#L108
@karol-f which version are you using exactly? I'm getting weird errors:
error - ../node_modules/next/dist/pages/_app.js
Error: Failed to deserialize argument at `2` as next_swc::TransformOptions
JSON: {"jsc":{"parser":{"syntax":"ecmascript","dynamicImport":true,"jsx":true},"transform":{"react":{"runtime":"automatic","pragma":"React.createElement","pragmaFrag":"React.Fragment","throwIfNamespace":true,"development":true,"useBuiltins":true}}},"disableNextSsg":true,"allowWrongLineComments":true,"pagesDir":"/Users/pmartiniere/dev/next-transpile-modules/src/__tests__/__apps__/swc/app/pages","env":{"targets":{"node":"16.11.1"}},"filename":"/Users/pmartiniere/dev/next-transpile-modules/src/__tests__/__apps__/swc/node_modules/next/dist/pages/_app.js","sourceMaps":true,"inlineSourcesContent":true,"sourceFileName":"/Users/pmartiniere/dev/next-transpile-modules/src/__tests__/__apps__/swc/node_modules/next/dist/pages/_app.js"}
Caused by:
unknown field `allowWrongLineComments` at line 1 column 726
The newest canary (from today) - so next@canary
+ proper experimental key settings in next.config.js
.
If you need some setup or GitHub repo example I can prepare one.
It looks like things work out of the box in canary.80
. Stick to this version and don't use @canary
, your build could break any time.
It looks like Next.js is experimenting with SWC. Investigate what it means for this plugin.