Currently running an angular 4 app with webpack and awesome typescript loader to compile Typescript into js for the build. Local execution using npm run start
functions correctly, but when attempting npm run build
, typescript files fail to compile to js resulting in the following errors:
ERROR in [at-loader] ./src/components/app.module.ts:21:39
TS2305: Module '"/Users/*******/Desktop/*****/src/services/index"' does not export member 'ArticlesService'.
ERROR in [at-loader] ./src/components/app.module.ts:27:10
TS2305: Module '"/Users/********/Desktop/*********/src/services/index"' does not export member 'StateService'.
...
ERROR in [at-loader] ./src/components/views/profile/profile.component.ts:3:40
TS2305: Module '"/Users/*********/Desktop/**********/src/services/index"' does not export member 'StateService'.
...
Child html-webpack-plugin for "index.html":
...
Child extract-text-webpack-plugin:
...
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee8f9e9eaedec0dec0de">[email protected]</a> build: `rimraf dist && webpack --progress --profile --bail`
npm ERR! Exit status 2
npm ERR!
...
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/*********/.npm/_logs/2018-10-04T15_40_20_857Z-debug.log
Below is a snippet from webpack.config.js file used for typescript configuration:
var atlOptions = '';
if (isTest && !isTestWatch) {
atlOptions = 'inlineSourceMap=true&sourceMap=false';
}
config.module = {
rules: [
// Support for .ts files.
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader?' + atlOptions, 'angular2-template-loader', '@angularclass/hmr-loader'],
exclude: [isTest ? /\.(e2e)\.ts$/ : /\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/]
}
This excerpt is taken from the tsconfig.json file:
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"emitDecoratorMetadata": true,
...
},
"compileOnSave": false,
...
}
Dependencies utilized in this project include node 8.10.0, npm 6.1.0, webpack 2.6.1, awesome-typescript-loader 3.1.3, typescript 2.6.1
Any insights on what could have been overlooked?