Closed shanmukhateja closed 4 years ago
Hey,
This library is merely a collection of utilities for working with Schematics, nothing more. You apparently need to bundle the dist
files of your package in a consumable way (and schematics-utilities
provides you some handy functions that might assist). This means, you should publish your package with sort of schematics
directory.
Actually I wrote a post that covers this: https://nitayneeman.com/posts/making-an-addable-angular-package-using-schematics
Also, you can check out the following project - which demonstrates a concrete package with ng-add
:
https://github.com/nitayneeman/angular-addable-package-example
Hey!
I used the very same article as reference to create the ng-add schematics to angular-datatables
and I think I understand the problem now.
In your post, you're using webpack to "bundle" all the necessary code into schematics/ng-add/index.js
in such a way that we wouldn't need schematics-utilities
package.
Any chance this could be done without introducing webpack
? The project uses rollup
to bundle the lib.
I tried rollup with this config:
rollup.schm.conf.js
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
export default {
input: './ng-add/index.js',
output: {
file: 'bundles/bundle.js',
name: 'angular.datatables.schematics',
format: 'cjs'
},
external: [
'@angular/core',
'@angular/platform-browser',
'@angular-devkit/core',
'@angular-devkit/schematics',
'@schematics/cli',
'chokidar',
'@angular/common',
'rxjs',
'jquery'
],
plugins: [
commonjs(),
resolve({
preferBuiltins: true,
mainFields: [''],
}),
json()
]
}
However, the output file is 18MB in size. Some help please?
Hi there! Regretfully, I have the same problem. Has anyone resolved this?
A workaround for now is to install schematics-utilities
using:
npm i -D schematics-utilities
Adter job's done, remove the package.
I'm closing this issue as we moved away from using this package and implementing the necessary minimal functionality based on ngx-bootstrap
and we do not face this issue anymore.
I've recently added
ng add
support toangular-datatables
project and my PR for it had been merged recently but I'm getting the following error when trying to install the package to clean Angular project.Error:
An unhandled exception occurred: Cannot find module 'schematics-utilities'
Stack Trace:
Steps to Reproduce:
ng new myproject