This site uses cookies for analytics. By continuing to browse this site, you agree to this use.
A JS Foundation Project

webpack compatible TypeScript `module`

webpack compatible TypeScript module (module-esnext-typescript)

Why is this important?

Webpack 2+ supports ES Modules out of the box and therefore doesn’t require you to transpile import/export statements resulting in smaller builds, and better 🌳 shaking.

What does the hint check?

This checks that you are using ‘module:”esnext”‘ in your tsconfig when you are using webpack 2+.

Example that trigger the hint

typescript-config parser not added to .hintrc.

{
    "connector": {...},
    "formatters": [...],
    "parsers": ["webpack-config"],
    "hints": {
        "webpack-config/module-esnext-typescript": "error",
        ...
    },
    ...
}

typescript-config configured but compilerOptions.module has a value different to esnext

{
    "compilerOptions": {
        "module": "commonjs"
    }
}

Examples that pass the hint

typescript-config configured and compilerOptions.module has the value esnext

{
    "compilerOptions": {
        "module": "esnext"
    }
}

Further Reading