Incorrect error Import declarations in a namespace cannot reference a module
? #8016
Closed
Description
Describe the bug
Since the Typescript pass rewrite, I get a Import declarations in a namespace cannot reference a module
for code which works fine in TSC and old swc
(This is inside of Parcel which uses the swc crate)
Input code
import commonPathPrefix = require('common-path-prefix');
The whole file: https://github.com/parcel-bundler/parcel/blob/c182930c631e3bf06034d5b350064152b57206ce/packages/utils/parcel-lsp/src/LspServer.ts#L27
Config
You can see the options used for invoking the Typescript swc pass here: https://github.com/parcel-bundler/parcel/pull/9271/files#diff-871dd9618b173ec16a893d692b991948e079f1f85c6db41db35eded117ba58f2
Playground link
Not yet published to the playground
SWC Info output
swc_core = { version = "0.83.26"
Expected behavior
Should work without an error
Actual behavior
@parcel/transformer-js: Import declarations in a namespace cannot reference a
module.
/home/runner/work/parcel/parcel/packages/utils/parcel-lsp/src/LspServer.ts:27:1
26 | import * as url from 'url';
> 27 | import commonPathPrefix = require('common-path-prefix');
> | ^
28 |
29 | // import {TextDocument} from 'vscode-languageserver-textdocument';
Version
swc_core "0.83.26"