Webpack builds successfully and I can browse to my webpage. However, the Javascript fails, saying: \'import declarations may only appear at top level of a module\'
B
If you're following the guide on https://webpack.js.org , you might not realise that site is only documenting Webpack version 2 or later, not Webpack 1. One of the new features of Webpack 2 is that it has native ES6 import, export and System.import.
You need to install Webpack 2 first:
npm install --save-dev webpack@2.2.0-rc.1
If you want to see a list of all Webpack releases, run:
npm show webpack versions --json