angularjs - Babel + Typescript + NPM Modules + Webpack -


hello try require angular typescript script, , error:

error ts2307: cannot find module 'angular'. 

here webpack config file:

    context: __dirname + '/client/js',     entry: './script.ts',     output: {         filename: 'build.js',         path: options.build ? 'dist' : 'dev'     },     module: {         loaders: [             {test: /\.ts(x?)$/, loader: 'babel-loader!ts-loader'}         ]     } 

edit:

then, in script.ts file, do:

import angular 'angular';  

or var angular = require('angular');

gives me same result

i don't have tsconfig.json file

thank !

i don't have tsconfig.json file

you need tsconfig.json file. see ts-loader readme : https://github.com/typestrong/ts-loader#configuration

example babel

checkout : https://github.com/typestrong/ts-loader/issues/93


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -