SWC builder output imports JSON files from outside the dist directory
andrucz opened this issue · comments
Acácio Andruczewicz commented
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
Output imports JSON files from outside the dist directory:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _packagejson = require("../package.json");
async function bootstrap() {
console.log('Version', _packagejson.version);
}
bootstrap();
Minimum reproduction code
https://gist.github.com/andrucz/d6b09ce51083f1c71b7d4b9c1f19ee29
Steps to reproduce
- Enable
resolveJsonModule
intsconfig.json
- Enable SWC builder
- Add
import { version } from '../package.json';
tomain.ts
- Run
npm run build
- Note that the imported JSON isn't copied to the dist directory
Expected behavior
SWC builder should copy the imported JSON to dist just like tsc does.
Package version
^10.0.0
NestJS version
^10.0.0
Node.js version
20
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
Kamil Mysliwiec commented
Please, report this issue in the swc repository