简体   繁体   中英

Modify .ts webpack loader to have multiple files

How can I modify my .ts webpack loader so that instead of having a single main.[hash].js file with my app's code I can have a .js file for each .ts file?

Right now this is my webpack loader to handle .ts files:

  output: {
   filename: '[name].[hash].js',
  },
  resolve: {
   extensions: ['', '.ts', '.js', '.json']
  },
  module: {
   loaders: [
   {
    test: /\.ts$/,
    exclude: [
      './node_modules'
    ],
    loaders: ['awesome-typescript-loader', 'angular2-template-loader']
  },

Thanks.

Edit: I'm actually looking to be able to search .ts files using google developers tools

The point of webpack is specifically to bundle and minty all your typescript into a single file. You don't want that, you can use gulp or some other task runner to just compile the TypeScript.

Got it, I just needed to add this option

module.exports = {
 devtool: 'source-map',

I should mention that I was actually looking to be able to search .ts files using google developers console and this does it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM