bundle: false rewrites "with { type: 'json' }" to deprecated "assert { type: 'json' }"
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
```ts
import {defineConfig} from 'tsup';
const config = defineConfig({
entry: [
'src/**/*.{js,cjs,mjs,ts,mts,json}'
],
platform: 'node',
// target: 'esnext',
outDir: './dist',
clean: true,
dts: true,
format: 'esm',
treeshake: true,
splitting: true,
bundle: false
});
export default config;
```
```ts
import data from '#foo/file.json' with {type: 'json'};
```
is being replaced with the deprecated syntax:
```ts
import data from '#foo/file.json' assert {type: 'json'};
^ SyntaxError: Unexpected identifier 'assert'
```
Contributor guide
Research direction
Start with the provided tsup configuration using `bundle: false` and the JSON import containing `with { type: 'json' }`; reproduce the output transformation and trace the path handling this syntax. Done means the emitted import retains the `with` form and no longer produces the deprecated `assert` syntax or the shown SyntaxError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100