Problem building AOT project with TurboTable

UI Components for Angular
Post Reply
alamb@zcorum.com
Posts: 1
Joined: 11 Jan 2017, 16:38

19 Jul 2018, 14:15

I have an angular / primeng project that I am trying to upgrade from version 4 (angular and primeng) to version 6 and I'm now having problems building it. Specifically, I've converted old dataTables into turboTables and when I perform a production build (AOT, Systemjs, rollup) I get the following error during the rollup step:

Error: Could not resolve './table' from aot\node_modules\primeng\components\table\table.ngfactory.js

It works fine with a dev build (no AOT or rollup) and it worked fine for production and dev builds with version 4 of angular and primeng. I've made a much smaller project that still has this issue and here are a few of most the relevant files from that smaller project:

package.json
------------------
{
"name": "primengAotTest",
"private": true,
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"postinstall": "typings install",
"lint": "tslint --project tsconfig.json",
"compile-aot": "node_modules/.bin/ngc -p tsconfig-aot.json",
"rollup": "node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c rollup-config.js",
"clean-aot": "del-cli aot",
"aot": "npm run clean-aot && npm run compile-aot && npm run rollup && npm run clean-aot",
"copyfiles-all": "copyfiles -s \"css/**/*\" \"lib/**/*\" ./built",
"copyfiles-dev": "npm run copyfiles-all && copyfiles systemjs.config.js \"app/**/*.html\" ./built && copyfiles -s \"node_modules/**/*\" \"typings/**/*\" ./built && copyfiles -u 2 \"index/dev/*\" ./built",
"copyfiles-production": "npm run copyfiles-all && copyfiles -u 2 \"index/production/*\" ./built",
"build-dev": "del-cli built && npm run tsc && npm run copyfiles-dev",
"build-production": "del-cli built && npm run aot && npm run copyfiles-production"
},
"dependencies": {
"@angular/animations": "~6.0",
"@angular/common": "~6.0",
"@angular/compiler": "~6.0",
"@angular/compiler-cli": "~6.0",
"@angular/core": "~6.0",
"@angular/forms": "~6.0",
"@angular/http": "~6.0",
"@angular/platform-browser": "~6.0",
"@angular/platform-browser-dynamic": "~6.0",
"@angular/platform-server": "~6.0",
"@angular/router": "~6.0",
"core-js": "~2.5",
"primeng": "~6.0",
"primeicons": "~1.0.0-beta",
"reflect-metadata": "~0.1",
"rxjs": "~6.2",
"systemjs": "~0.21",
"zone.js": "~0.8"
},
"devDependencies": {
"@types/core-js": "~0.9",
"del-cli": "^1.1.0",
"copyfiles": "~1.2",
"rollup": "^0.45.2",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-uglify": "^2.0.1",
"tslint": "~3.15",
"typescript": "~2.7",
"typings": "~2.1"
}
}

rollup-config.js
------------------
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';

export default {
entry: 'aot/app/main-aot.js',
dest: './built/app.js',
sourceMap: false,
format: 'iife',
onwarn: function(warning) {
// Skip certain warnings

// should intercept ... but doesn't in some rollup versions
if ( warning.code === 'THIS_IS_UNDEFINED' ) { return; }

// console.warn everything else
console.warn( warning.message );
},
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: 'node_modules/**',
namedExports: {
'node_modules/primeng/primeng.js': ['TableModule', 'Table']
}
}),
uglify()
]
};

tsconfig.json
------------------
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"lib": ["es6", "dom"],
"outDir": "./built/app",
"typeRoots": [
"../node_modules/@types"
]
},
"exclude": [
"node_modules",
"app/main-aot.ts"
]
}


tsconfig-aot.json
------------------
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"lib": ["es6", "dom"],
"outDir": "aot",
"typeRoots": [
"../node_modules/@types"
]
},
"exclude": [
"node_modules"
],
"angularCompilerOptions": {
"annotationsAs": "decorators",
"preserveWhitespace": false,
"skipMetadataEmit": true,
"strictInjectionParameters": true,
"fullTemplateTypeCheck": true
}
}


systemjs.config.js
------------------
(function (global) {
System.config({
paths: {
'npm:': 'node_modules/'
},
map: {
app: 'app',
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'rxjs': 'npm:rxjs',
'symbol-observable': 'npm:symbol-observable',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'primeng': 'npm:primeng'
},
packages: {
'app': {
main: './main.js',
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js',
main: 'index.js'
},
"rxjs/operators": {
defaultExtension: 'js',
main: 'index.js'
},
'symbol-observable': {
defaultExtension: 'js',
main: 'index.js'
},
'primeng': {
defaultExtension: 'js'
},
}
});
})(this);

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests