Skip to content

Config - TypeScript Setup Failing in Configuration Languages #1735

@youta1119

Description

@youta1119

Need Update how to write the webpack configuration with typescript. Current configuration is wrong.
ts-node dosenot support the module syntax of other than commonjs module.
So, if module in compilerOptions in tsconfig.json is not commonjs, webpack getting error. like this.

(function (exports, require, module, __filename, __dirname) { import * as path from "path";
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:588:28)
    at Module.m._compile (/Users/hogefuga/webpack-config-with-typescript/node_modules/ts-node/src/index.ts:392:23)

https://webpack.js.org/configuration/configuration-languages/#typescript

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions