Configure typescript, packaging error

  1. after migrating from react to typescript, to configure typescript, execute the packaging command

clipboard.png

tsconfig.json configuration

{
    "compilerOptions": {
        "outDir": "./dist/", // path to output directory
        "sourceMap": true, // allow sourcemap support
        "noImplicitAny": true,
        "strictNullChecks": true, // enable strict null checks as a best practice
        "module": "es6", // specify module code generation
        "jsx": "react", // use typescript to transpile jsx to js
        "target": "es5", // specify ECMAScript target version
        "allowJs": true // allow a partial TypeScript and JavaScript codebase
    },
    "include": ["./src/"]
}

partial configuration of webpack.conf.js

module: {
        rules: [
            {
                test: /\.(t|j)sx?$/,
                exclude: /node_modules/,
                use: ["awesome-typescript-loader"]
            },
            {
                enforce: "pre",
                test: /\.js$/,
                loader: "source-map-loader"
            },
        ]
    },
:
"webpack": "^3.12.0",
"awesome-typescript-loader": "^5.2.0",
"typescript": "^2.9.2",
"@types/react": "^16.4.11",
"@types/react-dom": "^16.0.7",

it doesn"t feel like a webpack version of the problem, and there is no corresponding solution on the Internet. What kind of problem do you solve?

May.22,2021

isn't that clear? @ storybook/react upgrade to 4.x


lower the version of awesome-typescript-loader. The latest version requires webpack4, but webpack4 is not backward compatible, so choose to lower the version of awesome-typescript-loader

Menu