dialogflow-javascript-client
dialogflow-javascript-client copied to clipboard
Module parse failed: Unexpected token (15:12)
Having such an error, when trying to include TypeScript version:
ERROR in ./node_modules/api-ai-javascript/ts/ApiAiClient.ts Module parse failed: Unexpected token (15:12) You may need an appropriate loader to handle this file type. | export class ApiAiClient { | | private apiLang: Constants.AVAILABLE_LANGUAGES; | private apiVersion: string; | private apiBaseUrl: string; @ ./node_modules/api-ai-javascript/ts/_build.ts 1:0-42 @ ./node_modules/api-ai-javascript/index.ts @ ./src/index.ts
However, I have ts-loaded included and it works for other ts files. Webpack config:
module.exports = { entry: './src/index.ts', devtool: 'inline-source-map', module: { rules: [{ test: /.tsx?$/, loader: 'ts-loader', exclude: /node_modules/ }] }, resolve: { extensions: ['.tsx', '.ts', '.js'] }, output: { filename: 'bundle.js', path: path.resolve(__dirname, 'public/js') }, devServer: { port: 8000, historyApiFallback: { index: 'larissa.html', }, contentBase: 'public' } };