TypeStrong / TypeStrong/ts-loader
ts-loader forces 'isolatedModules' enabled when transpileOnly: true
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.5k
- Forks
- 439
- Avg merge
- 17h 17m
- Merged PRs (30d)
- 2
Description
Expected Behaviour
Successfully compile project with:
transpileOnly: true in ts-loader and "isolatedModules": false in tsconfig.json
Actual Behaviour
Steps to Reproduce the Problem
// src/index.ts
import { JumpType } from "./enum";
console.log("JumpType.AUTO", JumpType.AUTO);
// src/enum.ts
export const enum JumpType {
INVALID = "INVALID",
AUTO = "AUTO",
CLICK = "CLICK",
}
// webpack.config.js
const path = require("path");
const webpack = require("webpack");
const rootDir = path.resolve(__dirname, ".");
module.exports = {
entry: path.join(rootDir, "src/index.ts"),
cache: false,
mode: 'production',
optimization: {
minimize: false,
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: "ts-loader",
options: {
transpileOnly: true,
},
},
],
},
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
}
};
// tsconfig.json
{
"compilerOptions": {
"preserveConstEnums": false,
"isolatedModules": false,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"module": "esnext",
"target": "es2015",
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
},
"exclude": ["**/node_modules/"]
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from webpack.config.js using the src/index.ts and src/enum.ts entry files with tsconfig.json setting transpileOnly to true and isolatedModules to false. Inspect ts-loader's handling of these compiler options and verify that the project compiles without forcing isolatedModules on; the reproduction should complete successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, webpack
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100