1

私はAngular2アプリケーションに取り組んでいます。ドキュメントを読み、AOT とロールアップを実装しました。アプリケーションに es6 以外のモジュールがいくつかあります。ロールアップ後、webpack を使用して js をバンドルし、「require」ステートメントを必要なライブラリ コードに置き換えます。すべてのステップで sourceMap を生成しましたが、それでもコンソールにエラーが表示された場合、正しい行が反映されません。以下は、私の aot、ロールアップ、および webpack の構成です。「sourceMap」オプションは、各構成で「true」に設定されています。お知らせ下さい。

tsconfig.aot.js

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "allowUnreachableCode": true,
    "suppressImplicitAnyIndexErrors": true,
    "allowSyntheticDefaultImports": true
  },
  "angularCompilerOptions": {
    "genDir": "aot",
    "skipMetadataEmit" : true
  },
  "compileOnSave": false,
  "files": [
    "scripts/app.module.ts",
    "scripts/main.ts"
  ],
  "exclude": [
    "node_modules",
    "dist"
  ]
}

ロールアップ.ts

export default {
    entry: 'scripts/main.js',
    dest: 'build/app.js', // output a single application bundle
    sourceMap: true,
    format: 'iife',
    context: 'this',
    plugins: [

        nodeResolve(
            {
                jsnext: true,
                module: true,
            }
        ),
        commonjs({
            include: 'node_modules/**/**',
        })  ,

    ]
}

そして最後にWebpack

プラグイン: [

//Does type checking in a separate process, so webpack don't need to wait.
new ForkCheckerPlugin(),
new ExtractTextPlugin("styles/[name].css"),

//Varies the distribution of the ids to get the smallest id length for often used ids.
new webpack.optimize.OccurenceOrderPlugin(true),

//Copy files and directories in webpack. Copies project static assets.
new CopyWebpackPlugin([{
  from: root('assets'),
  to: root('build/assets')
}]),

    new webpack.optimize.DedupePlugin(),

    new webpack.optimize.UglifyJsPlugin({sourceMap: true}),

    new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /de|it/)

]、

4

0 に答える 0