webpack release v2.1.0-beta.28で(私は2.2.0-rc.1を使用しています)モジュールビルドに失敗しました:SyntaxError: 'import'と 'export'はトップレベルにのみ表示されます
add
import()
as Code Splitting construct. It should be used instead ofSystem.import
when possible. System.import will be deprecated in webpack 2 release (removed in webpack 3) as it's behavior is incorrect according to the spec.
は、だから私は、変換:
import('./hero/homepage')
.then(module => module.default)
.catch(err => console.error(`Chunk loading failed, ${err}`))
しかし取得:
require.ensure(['./hero/homepage'],() => {
require('./hero/homepage')
}, 'hero-homepage')
中に、Module build failed: SyntaxError: 'import' and 'export' may only appear at the top level
webpackの設定に追加する必要があるものがあります。
が必要になりますです。 https://stackoverflow.com/questions/39158552/ignore-eslint-error-import-and-export-may-only-appear-at-the-top-level –