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

fix(register): enable keepImportAttributes in SWC options #816

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ function transformOption(path: string, options?: Options, jest = false): SwcOpti
keepClassNames: opts.keepClassNames,
paths: opts.paths,
baseUrl: opts.baseUrl,
experimental: {
keepImportAttributes: true,
},
},
minify: false,
isModule: true,
Expand Down
7 changes: 7 additions & 0 deletions packages/integrate-module/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { baz } from './subdirectory/index.mjs'
import { Component } from './component.js'
import { common } from './common.cjs'
import './js-module.mjs'
import pgkJson from '../package.json' assert { type: 'json' }
import pgkJsonWith from '../package.json' with { type: 'json' }

const { foo: fooWithQuery } = await import(`./foo.mjs?q=${Date.now()}`)

Expand Down Expand Up @@ -67,3 +69,8 @@ await test('resolve local cjs module', () => {
await test('resolve commonjs module', () => {
assert.equal(common, 'common')
})

await test('resolve json file', () => {
assert.equal(pgkJson.name, 'integrate-module')
assert.equal(pgkJsonWith.name, 'integrate-module')
})