Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts-loader forces 'isolatedModules' enabled when transpileOnly: true #1645

Open
utc8 opened this issue Feb 27, 2024 · 0 comments
Open

ts-loader forces 'isolatedModules' enabled when transpileOnly: true #1645

utc8 opened this issue Feb 27, 2024 · 0 comments

Comments

@utc8
Copy link

utc8 commented Feb 27, 2024

Expected Behaviour

Successfully compile project with:

transpileOnly: true in ts-loader and "isolatedModules": false in tsconfig.json

Actual Behaviour

image

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/"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant