Skip to content

Commit

Permalink
fix(register): enable keepImportAttributes in SWC options (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn authored Jul 14, 2024
1 parent 9037fc9 commit 33568ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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')
})

0 comments on commit 33568ee

Please sign in to comment.