Error: 'Unexpected value' undefined 'imported by the AppModule when importing the module created by webpack

I built an Angular2 (RC6) module using Webpack (tried both 1.x and 2.x) and published it before npm, but when I import this module depending on my section AppModule(import), I get this error while fulfillment.

If I create using the command tsc, then I do not get this error. I need Webpack because I have html and css files that need to be added to the file js.

And everything works fine if I build all my modules in one set.

My webpack.config.js looks like this:

const webpack = require('webpack');
const path = require('path');

module.exports = {
    devtool: 'cheap-module-source-map',
    entry: './index.ts',
    output: {
        path: './dist',
        filename: 'index.js'
    },
    resolve: {
      root: [ path.join(__dirname, 'src') ],
      extensions: ['', '.ts', '.js']
    },
    module: {
        loaders: [
          { test: /\.ts$/, loaders: ['awesome-typescript-loader'] },
          { test: /\.(html|css)$/, loader: 'raw-loader' }
        ]
    }
}

Any thoughts?

+4

Source: https://habr.com/ru/post/1653844/


All Articles