AngularJS ES6 Webpack – couldn’t process source due to parse error,’import’ and ‘export’ may appear only with ‘sourceType: module’
I am trying to compile a project written with AngularJS ES6 and when compiling it throws me the following error
ERROR in ./src/app.module.js
Module build failed: error: couldn't process source due to parse error,'import' and 'export' may appear only with 'sourceType: module' (2:0)
@ multi (webpack)-dev-server/client?http://localhost:3000 ./src/app.module.js
ERROR in ./src/vendor.module.js
Module build failed: error: couldn't process source due to parse error,'import' and 'export' may appear only with 'sourceType: module' (5:0)
@ multi (webpack)-dev-server/client?http://localhost:3000 ./src/vendor.module.js
These are the modules to import, can someone tell me what the error is?
app.module.js
// for loading styles we need to load main scss file
import styles from './assets/styles.scss';
// loading shared module
import './modules/common/common.module';
import './modules/login/login.module';
import './modules/dashboard/dashboard.module';
import './modules/investment/investment.module';
import './modules/transfer/transfer.module';
import Config from './modules/common/factories/Config';
import './modules/user/user.module';
import './modules/product/product.module';
...
vendor.module.js
/**
* Load all 3rd party imports here so it'll be
* directly included in vendor.bundle.js file.
*/
import 'angular-ui-router';
import 'angular-resource';
import 'angular-animate';
import 'angular-aria';
import 'angular-input-masks';
import 'jquery';
import 'popper.js';
import 'bootstrap/dist/js/bootstrap.min.js';
import 'angular-material/angular-material';
import 'angular-wizard/dist/angular-wizard.min.js';
import 'md-steppers/dist/md-steppers.min.js';
import 'angular-ui-bootstrap';
import 'jquery-knob/dist/jquery.knob.min.js';
import 'ng-ui-knob/dist/ng-knob.js';
import './assets/lib/ngMask.min.js';
The command I use to compile is the following
node_modules/.bin/webpack --progress
Source: AngularJS Questions