angularjs - Angular 1.6 with typescript 2.4, gulp to webpack transition -
i think having typing issue. have angular 1.6 project being built using gulp , company wants switch webpack 3. think close getting project build having typing issue backed.d.ts file full of our types , api calls not being recognized think in webpack or compiling .ts files, hard tell which.
here webpack.config.js
module.exports = { entry: { 'vendor': './source/vendor.ts', 'main': './source/index.ts' }, target: 'node', output: { filename: '[name].[chunkhash].js', path: path.join(__dirname, '/webpack-build'), chunkfilename: '[name].[chunkhash].js' }, plugins: [ new webpack.optimize.commonschunkplugin({ name: 'vendor', minchunks: infinity, }), new webpackmd5hash(), new inlinemanifestwebpackplugin({ name: 'webpackmanifest' }), new htmlwebpackplugin({ template: './source/index.html', }), new extracttextplugin('pack.[contenthash].css') ], devtool: 'source-map', resolve: { modules: ['source', 'node_modules'], extensions: ['.ts', '.d.ts', '.js', '.json'] }, module: { noparse: [ /aws-sdk/ ], rules: [ { test: /\.ts/, include: [ __dirname ], exclude: [ '/react/', '/tests/', '/compiled/' ], use: [ { loader: 'babel-loader' }, { loader: 'ng-annotate-loader' }, { loader: 'awesome-typescript-loader' } ] }, { test: /\.js$/, include: [ '/node_modules/' ], use: 'babel-loader' }, { test: /\.json/, use: 'json-loader' }, { test: /\.(png|jpg|svg)$/, use: { loader: 'url-loader' } } ] } }
and tsconfig.json
{ "compileroptions": { "target": "es6", "module": "commonjs", "moduleresolution": "node", "sourcemap": true, "emitdecoratormetadata": true, "experimentaldecorators": true, "lib": [ "es2015", "dom" ], "noimplicitany": true, "allowjs": true, "suppressimplicitanyindexerrors": true }, "files": [ "../typings/tsd.d.ts", "./source/swagger/backend.d.ts" ]
}
in vendor.ts single import 'backend' should importing types , backend.d.ts build use types angular code. instead here of errors below along many more.
error in [at-loader] ./source/index.ts:1715:113 ts2304: cannot find name 'sessioncookieservice'.
error in [at-loader] ./source/index.ts:1716:37 ts2304: cannot find name 'applicationsettingsservice'.
error in [at-loader] ./source/index.ts:1717:17 ts2503: cannot find namespace 'angular'.
error in [at-loader] ./source/index.ts:1717:51 ts2304: cannot find name 'states'.
error in [at-loader] ./source/index.ts:1718:24 ts2304: cannot find name 'searchservice'.
error in [at-loader] ./source/swagger/backend.d.ts:5:9 ts2503: cannot find namespace 'ng'.
error in [at-loader] ./source/swagger/backend.d.ts:10:9 ts2503: cannot find namespace 'ng'.
error in [at-loader] ./source/swagger/backend.d.ts:15:9 ts2503: cannot find namespace 'ng'.
error in [at-loader] ./source/swagger/backend.d.ts:21:9 ts2503: cannot find namespace 'ng'.
error in [at-loader] ./source/swagger/backend.d.ts:29:9 ts2503: cannot find namespace 'ng'.
update: npm @types/angular --save got rid of cannot find namespace 'ng' error there error in [at-loader] ./source/index.ts:1717:25 ts2694: namespace 'angular' has no exported member 'ui'.
and custom types not being recognized since think not importing files correctly many incorrect ways import things now.
Comments
Post a Comment