diff --git a/packages/core/index.ts b/packages/core/index.ts index b9bfa5fb4..6c59ab82f 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -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, diff --git a/packages/integrate-module/src/index.ts b/packages/integrate-module/src/index.ts index ce2c4007e..27488819d 100644 --- a/packages/integrate-module/src/index.ts +++ b/packages/integrate-module/src/index.ts @@ -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()}`) @@ -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') +})