2017-07-01 27 views
2

でERRORを私はNGを実行しようとすると、私はngが失敗したサーブ - WebPACKのはコンパイルに失敗した - ./src/main/webapp/manifest.webapp

ERROR in ./src/main/webapp/manifest.webapp 
Module parse failed: /home/fergal/dev/jhipster/sam/git/sam/src/main/webapp/manifest.webapp Unexpected token (2:8) 
You may need an appropriate loader to handle this file type. 
| { 
| "name": "Sam", 
| "short_name": "Sam", 
| "icons": [ 
@ ./src/main/webapp/app/polyfills.ts 6:0-29 
@ multi ./src/main/webapp/app/polyfills.ts 
webpack: Failed to compile. 
webpack: Compiling... 

私のWebPACKの内容については下記を参照してください、次の取得に役立ちます.dev.js。 これが正しいファイルであるかどうかは不明です。 何が間違っているか考えてください。 またはそれをさらに調査する方法は? すべてのポインタ/アドバイス、大歓迎です。

ありがとう、 Fergal。

const webpack = require('webpack'); 
const writeFilePlugin = require('write-file-webpack-plugin'); 
const webpackMerge = require('webpack-merge'); 
const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); 
const ExtractTextPlugin = require("extract-text-webpack-plugin"); 
const execSync = require('child_process').execSync; 
const fs = require('fs'); 
const path = require('path'); 

const commonConfig = require('./webpack.common.js'); 

const ddlPath = './target/www/vendor.json'; 
const ENV = 'dev'; 

if (!fs.existsSync(ddlPath)) { 
    execSync('webpack --config webpack/webpack.vendor.js'); 
} 

module.exports = webpackMerge(commonConfig({ env: ENV }), { 
    devtool: 'inline-source-map', 
    devServer: { 
     contentBase: './target/www', 
     proxy: [{ 
      context: [ 
       /* jhipster-needle-add-entity-to-webpack - JHipster will add entity api paths here */ 
       '/api', 
       '/management', 
       '/swagger-resources', 
       '/v2/api-docs', 
       '/h2-console' 
      ], 
      target: 'http://127.0.0.1:8080', 
      secure: false 
     }] 
    }, 
    output: { 
     path: path.resolve('target/www'), 
     filename: 'app/[name].bundle.js', 
     chunkFilename: 'app/[id].chunk.js' 
    }, 
    module: { 
     rules: [{ 
      test: /\.ts$/, 
      loaders: [ 
       'tslint-loader','json-loader' 
      ], 
      exclude: ['node_modules', new RegExp('reflect-metadata\\' + path.sep + 'Reflect\\.ts')] 
     }] 
    }, 
    plugins: [ 
     new BrowserSyncPlugin({ 
      host: 'localhost', 
      port: 9000, 
      proxy: { 
       target: 'http://localhost:9060' 
      } 
     }, { 
      reload: false 
     }), 
     new ExtractTextPlugin('styles.css'), 
     new webpack.NoEmitOnErrorsPlugin(), 
     new webpack.NamedModulesPlugin(), 
     new writeFilePlugin(), 
     new webpack.WatchIgnorePlugin([ 
      path.resolve('./src/test'), 
     ]) 
    ]}); 
+0

まだ私の問題です。どんな助けでも大歓迎です。おかげさまで –

答えて

3

あなたはjhipsterを使用しているようです。あなたのpackage.jsonには、あらかじめ定義されたnpmスクリプトのセットがあります。 jhipsterを使って新しいプロジェクトを生成すると、直接ngに依存するのではなく、webpackを使用してconfigsを直接生成します。

yarn start(または糸の代わりにnpmを使用する場合はnpm run start)を試してください。

問題の根本原因は、angular-cli内の埋め込みWebpack設定が* .webappファイルの処理方法を知らないことです。 WebPACKのディレクトリ内のファイルwebpack.common.js生成

は、実際にそれを処理する方法を定義します。

{ 
    test: /manifest.webapp$/, 
    loader: 'file-loader?name=manifest.webapp!web-app-manifest-loader' 
} 

だから、上記のコマンドを使用して代わりのng serveを使用してトリックを行う必要があります。

+0

あなたの答えをありがとう。あなたは完全に正しい。それはまさにそれです。これで問題は解決しました。今、私は分かる。 –

関連する問題