Open lijialiang opened 6 years ago
"devDependencies": { "@babel/core": "^7.0.0-beta.42", "@babel/plugin-proposal-optional-chaining": "^7.0.0-beta.42", "awesome-typescript-loader": "^4.0.1", "webpack": "^4.2.0", "webpack-cli": "^2.0.13", "babel-loader": "^8.0.0-beta.2", "typescript": "^2.7.2" }
module.exports = { mode: 'production', entry: [ './index-1.js', './index-2.ts', ], output: { filename: '[name].tt.js', }, module: { rules: [ { test: /\.*(js|jsx)$/, exclude: /node_modules/, use: [ { loader: 'babel-loader', options: { presets: [ ], plugins: [ '@babel/plugin-proposal-optional-chaining', ], } }, ] }, { test: /\.*(ts|tsx)$/, exclude: /node_modules/, use: [ { loader: 'awesome-typescript-loader', options: { silent: true, configFileName: './tsconfig.json', useBabel: true, babelCore: '@babel/core', babelOptions: { babelrc: false, presets: [ ], plugins: [ '@babel/plugin-proposal-optional-chaining', ], }, }, } ] }, ] } };
console.log( window.test?.( ) );
the js file can be compiled, the ts file has error.
ERROR in ./index-2.ts Module build failed: SyntaxError: index-2.ts: Unexpected token (1:26) > 1 | console.log(window.test ? .() : ); ``
Having the same issue. Did you resolve it?
@Nazar32 sorry, I have not found a suitable solution yet :(
package.json
webpack.config.js
index-1.js & index-2.ts
Problem
the js file can be compiled, the ts file has error.