Skip to content

Do not emit json file with config flag "resolveJsonModule" = true #847

@sevenryze

Description

@sevenryze

Expected Behaviour

Emit json files when we set this tsconfig flag "resolveJsonModule" to be true.

Actual Behaviour

There is no any json file emitted.

Steps to Reproduce the Problem

Given the folder structure:

src/
    index.ts  <--- this file `import package from "../package.json"`
package.json
webpack.config.js

The webpack config like below:

entry: {
    "src/index": path.join(__dirname, "src/index.ts")
  },
output: {
    path: path.join(__dirname, "dist"),
},
loader: "ts-loader" with no other options.

and tsconfig.json like below:

{
  "compilerOptions": {
    "module": "commonjs", 
    "moduleResolution": "node",
    "target": "esnext",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "sourceMap": true,
    "resolveJsonModule": true,
    "declaration": true,
    "declarationMap": true,
    "removeComments": true,
    "strict": true,
    "alwaysStrict": true
  },

  "include": ["src"]
}

After invoke webpack, I only get the dist/src/index.js file, not the dist/package.json file.

Location of a Minimal Repository that Demonstrates the Issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions