ngUpgraders / ng-forward

The default solution for those that want to write Angular 2.x style code in Angular 1.x
410 stars 36 forks source link

Error in jqlite-extensions.ts - cannot find module './' #137

Closed jasonmacdonald closed 8 years ago

jasonmacdonald commented 8 years ago

Trying to use the TestComponentBuilder to build a test and as soon as I add the library from 'ng-forward/cjs/testing' I get this cryptic error...

ERROR in ...\node_modules\ng-forward\cjs\util\jqlite-extensions.d.ts (1,20): error TS2307: Cannot find module './'.

The strange part is the test still passes but I've not been able to track down what is causing this error. Any ideas?

Here's the very simple test I am running...

import {Component} from 'ng-forward';
import {TestComponentBuilder} from 'ng-forward/cjs/testing';

describe('Home', () => {
    it('should have name', () => {
        expect(1).toBe(1);
    });
})

As you can see I'm not even using the TestComponentBuilder yet, just adding it throws the error.

And my spec.bundle is...

import 'angular';
import 'angular-mocks';
import 'babel-polyfill';
import 'karma-phantomjs-shim/shim';
import 'reflect-metadata';

let context = require.context('./src', true, /\.spec\.ts/);
context.keys().forEach(context);

This is being run through Webpack using the TypeScript loader. I can post my karma config if needed, but it's pretty standard.

jasonmacdonald commented 8 years ago

Actually, I think it's this line at the top of the jqLite-extension...

import JQuery from "./";

Webpack can't find './'

update: changing that line to import "jquery"; makes the error go away. But, I have no idea why it was set to './' so not sure if this breaks something.

laurelnaiad commented 8 years ago

'./' breaks something, that's for sure.. and it's not jut about webpack. The typescript compiler can't find such a file at all, nevermind a bundler. What's weird is that that import has been there since inception of the file. I wonder if the .ts tranpile process being used on ng-forward does typechecking? Why is nobody else tripping over this, I wonder.

laurelnaiad commented 8 years ago

I went with "delete that line and change references to IAugmentedJQuery" in the branch seen above.