Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking compile-time .ts error on module inclusion. #5

Closed
preston opened this issue Mar 8, 2017 · 11 comments
Closed

Breaking compile-time .ts error on module inclusion. #5

preston opened this issue Mar 8, 2017 · 11 comments
Assignees

Comments

@preston
Copy link

preston commented Mar 8, 2017

When following the component usage instructions, it looks like there's an issue with the packaged TypeScript declarations. For example:

ERROR in ./~/cql-runner/index.ts
Module build failed: Error: Typescript emitted no output for /Users/preston/Developer/git/knartwork/node_modules/cql-runner/index.ts.
You should not need to recompile .ts files in node_modules.
Please contact the package author to advise them to use --declaration --outDir.
More microsoft/TypeScript#12358
at Object.loader (/Users/preston/Developer/git/knartwork/node_modules/ts-loader/dist/index.js:33:15)
@ ./src/app.module.ts 14:19-40
Warning: Task "webpack:build" failed. Use --force to continue.
Aborted due to warnings.

@c-schuler c-schuler self-assigned this Mar 8, 2017
@c-schuler
Copy link
Contributor

Published new version with npm using outDir + .d.ts + .js method. Also eliminated the previous styling requirements.

@preston
Copy link
Author

preston commented Mar 8, 2017

v1.0.2 unfortunately still breaks:

WARNING in ./~/cql-runner/index.js
Cannot find SourceMap 'index.js.map': Error: Cannot resolve 'file' or 'directory' ./index.js.map in /Users/preston/Developer/git/knartwork/node_modules/cql-runner

ERROR in ./~/cql-runner/cql-runner-wrapper.component.ts
(8,13): error TS2304: Cannot find name 'module'.

ERROR in .//cql-runner/cql-runner-wrapper.module.ts
Module build failed: Error: Typescript emitted no output for /Users/preston/Developer/git/knartwork/node_modules/cql-runner/cql-runner-wrapper.module.ts.
You should not need to recompile .ts files in node_modules.
Please contact the package author to advise them to use --declaration --outDir.
More microsoft/TypeScript#12358
at Object.loader (/Users/preston/Developer/git/knartwork/node_modules/ts-loader/dist/index.js:33:15)
@ ./
/cql-runner/index.js 5:9-47

ERROR in .//cql-runner/cql-runner-wrapper.component.ts
Module build failed: Error: Typescript emitted no output for /Users/preston/Developer/git/knartwork/node_modules/cql-runner/cql-runner-wrapper.component.ts.
You should not need to recompile .ts files in node_modules.
Please contact the package author to advise them to use --declaration --outDir.
More microsoft/TypeScript#12358
at Object.loader (/Users/preston/Developer/git/knartwork/node_modules/ts-loader/dist/index.js:33:15)
@ ./
/cql-runner/index.js 6:9-50
Warning: Task "webpack:build" failed. Use --force to continue.

Aborted due to warnings.

@c-schuler
Copy link
Contributor

Pushed version 1.0.9 to npm. Used different method with more stringent testing. Let me know how it goes.

@preston
Copy link
Author

preston commented Mar 9, 2017

Still broken, unfortunately. With v1.0.9:

ERROR in ./src/app.module.ts
(7,10): error TS2305: Module '"/Users/preston/Developer/git/knartwork/node_modules/cql-runner/index"' has no exported member 'CqlRunnerModule'.

ERROR in /Users/preston/Developer/git/knartwork/tsconfig.json
error TS6059: File '/Users/preston/Developer/git/knartwork/node_modules/ng2-ace-editor/src/component.ts' is not under 'rootDir' '/Users/preston/Developer/git/knartwork/src'. 'rootDir' is expected to contain all source files.

ERROR in /Users/preston/Developer/git/knartwork/tsconfig.json
error TS6059: File '/Users/preston/Developer/git/knartwork/node_modules/ng2-ace-editor/src/directive.ts' is not under 'rootDir' '/Users/preston/Developer/git/knartwork/src'. 'rootDir' is expected to contain all source files.

ERROR in /Users/preston/Developer/git/knartwork/tsconfig.json
error TS6059: File '/Users/preston/Developer/git/knartwork/node_modules/ng2-ace-editor/src/module.ts' is not under 'rootDir' '/Users/preston/Developer/git/knartwork/src'. 'rootDir' is expected to contain all source files.
Warning: Task "webpack:build" failed. Use --force to continue.

Aborted due to warnings.

If you need a downstream project to help test, I've gone ahead and intentionally committed the broken Knartwork integration over in that repo, if that helps: https://github.com/cqframework/knartwork

@c-schuler
Copy link
Contributor

Please follow the instructions here:
https://www.npmjs.com/package/cql-runner

Note that CqlRunnerModule is now just RunnerModule

@c-schuler
Copy link
Contributor

I have gotten past those errors.

The first error is resolved by renaming the CqlRunnerModule to RunnerModule and also listing the ApiService as a provider in the base module.

The next three can be resolved with a change to the tsconfig:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false,
        "outDir": "build"
    },
    "compileOnSave": false,
    "include": [
        "src/**/*",
        "node_modules/ng2-ace-editor/**/*",
        "node_modules/cql-ace-syntax/*"
    ],
    "exclude": [
        "node_modules",
        "bower_components",
        "typings/globals",
        "typings/index.d.ts"
    ],
    "filesGlob": [
        "src/**/*.ts"
    ]
}

Furthermore, in the applicaton.pug file, add this script before the main.bundle.js script:
script(src="ace.js")

Now append the following to the "copy" Grunt task:

{
   cwd: 'node_modules/cql-ace-syntax/',
   src: "ace.js",
   dest: 'build/',
   expand: true
}

That should get you up and running. I have verified that this solution works with the knartwork project.

@c-schuler
Copy link
Contributor

Issued pull request with solution here:
preston/knartwork#4

Will leave this issue open until I get your feedback.

@preston
Copy link
Author

preston commented Mar 16, 2017

@c-schuler Thanks for the update! I'm hoping to look at this soon .. just been on work travel this week.

@preston
Copy link
Author

preston commented May 31, 2017

@c-schuler Getting very close ... everything does seem to be building again and other updates for the Angular 4 release have been included. When adding a cql-runner component, I'm getting:

vendor.bundle.js:1450 ERROR ReferenceError: CodeMirror is not defined
    at new RunnerComponent (main.bundle.js:5806)
    at createClass (vendor.bundle.js:11258)
    at createDirectiveInstance (vendor.bundle.js:11089)

I'm not sure where CodeMirror is supposed to be defined.

@c-schuler
Copy link
Contributor

c-schuler commented May 31, 2017

I am working on an NPM module with CodeMirror, but there is not a functional release yet...

Please use the cql-runner 1.0.9 npm package.

Sorry for the confusion...

@preston
Copy link
Author

preston commented Jun 2, 2017

Seems to be happier with v1.0.9. I would suggest yanking the broken ones if possible before anyone tries them.

@preston preston closed this as completed Jun 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants