Wednesday, 15 January 2014

requirejs - import statement broken from migration 1.0.3 to 1.1 or higher -



requirejs - import statement broken from migration 1.0.3 to 1.1 or higher -

using typescript in amd modes import statement broken version 1.0.3 1.1.

directory structure:

batteryincluded/textwriter.ts batteryincluded/registry.ts

code registry.ts:

import textwriter = require("batteryincluded/textwriter"); class registry <valuetype> { // etc... } export = registry;

code textwriter.ts:

class textwriter { // etc.. } export = textwriter;

in typescript version 1.0.3 error not occur. in version 1.1 or higher error is:

"c:/program files/nodejs/node.exe" c:\project_git\typescript\built\local\tsc.js --sourcemap -- target es5 --module amd registry.ts registry.ts(2,29): error ts2307: cannot find external module 'batteryincluded/textwriter'.

using typescript in form of:

node c:\project_git\typescript\built\local\tsc.js --sourcemap --target es5 --module amd $filename$

to prepare problem can utilize import statement:

import textwriter = require("./textwriter");

this not desired because nested files need this:

import textwriter = require("../../../textwriter");

before use:

import textwriter = require("batteryincluded/textwriter");

i have searched on typescript github repro release changes imply error, couldn't find any.

i have downloaded typescript 1.1 test , works file me - difference have entry point app.ts in root, loads batteryincluded/registry in turn loads batteryincluded/textwriter , compiles fine.

i thought maybe if pointed compiler @ batteryincluded/registry might assume root, create path invalid. tested theory , compiled fine me also.

the remaining difference i'm compiling command line.

here files used - perhaps give them go see if issues (the nested folder name in illustration nested).

requirejs typescript amd

No comments:

Post a Comment