fork-ts-checker-webpack-plugin icon indicating copy to clipboard operation
fork-ts-checker-webpack-plugin copied to clipboard

Q: warning "class not found" after adding plugin, "module has no exports" - possibly configuration?

Open mroeling opened this issue 6 months ago • 0 comments

Since the plugin is working already in many cases, I suspect this is more like a question than a bug.

Based on the blog on Aurelia1 (link), I've tried to add the plugin to our Aurelia1 project.

But I get many warnings, all formed like:

WARNING in ./<filepath>.ts 84:163-180
export '<ClassName>' (imported as '<ClassName>') was not found in '~/<filepath>'
 (module has no exports)

Note the "~" part, that's part of the tsconfig (added below)

Before adding the plugin, this was never an error/warning.

Things I've tried:

  • verbatimModuleSyntax / importsNotUsedAsValues in tsconfig
  • useTypescriptIncrementalApi in webpack config

the tsconfig:

{
  "compileOnSave": false,
  "compilerOptions": {
    "esModuleInterop": true,
    "module": "ESNext",
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "target": "ES2018",
    "lib": ["ES2015", "DOM"],
    "moduleResolution": "Bundler",
    "baseUrl": "src",
    "paths": {
      "~/*": ["./*"],                                                // <!-- possible cause?
      "~sdk/*": ["../resources/generated/sdk/*"]
    },
    "resolveJsonModule": true,
    "importHelpers": true,
    "allowJs": true
  },
  "include": ["src", "test"],
  "atom": {
    "rewriteTsconfig": false
  }
}

The webpack config is rather large. So a snippet to show at least the imports, and the config I added.

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin");
const project = require("./aurelia_project/aurelia.json");
const { AureliaPlugin } = require("aurelia-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const CspHtmlWebpackPlugin = require("csp-html-webpack-plugin");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");

// snip

module.exports = ({ production }, { analyze, hmr, port, host }) => ({
  cache: production === "development" ? {
    type: 'filesystem',
  } : false,
// snip
  plugins: [
// snip
    new ForkTsCheckerWebpackPlugin({
      typescript: {
        diagnosticOptions: {
          semantic: true,
          syntactic: true,
        },
      },
    }),
  ],
})

Any help will be appreciated! It's too promising to just skip :)

mroeling avatar Jun 27 '25 09:06 mroeling