Ember-cli-typescript: Yarn workspace & linked addon files rebuild problem

Created on 7 Nov 2018  路  4Comments  路  Source: typed-ember/ember-cli-typescript

ember-cli: 3.1.4
node: 8.9.4
os: win32 x64

My tsconfig.json

{
  "compilerOptions": {
    "target": "es2017",
    "allowJs": true,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noEmitOnError": false,
    "noEmit": true,
    "inlineSourceMap": true,
    "inlineSources": true,
    "baseUrl": ".",
    "module": "es6",
    "paths": {
      "dreamcatcher-web-app/tests/*": ["tests/*"],
      "dreamcatcher-web-app": ["app/*", "node_modules/syn-shared/app/*"],
      "syn-shared": [ "node_modules/syn-shared/addon" ],
      "syn-shared/*": [ "node_modules/syn-shared/addon/*" ],
      "*": ["types/*"]
    },
    "experimentalDecorators": true
  },
  "include": [
    "app/**/*",
    "tests/**/*",
    "types/**/*",
    "node_modules/syn-shared/app/**/*",
    "node_modules/syn-shared/addon/**/*"
  ],
  "exclude": ["tmp/**/*", "vendor/**/*", "dist/**/*"]
}

My Yarn workspace config

{
  "private": true,
  "workspaces": {
    "packages": [
      "syn-shared",
      "grdd"
    ]
  }
}

Given:
yarn workspace,
grdd -> main application folder
syn-shared -> addon folder

What did you expect to see?

If I run my grdd application, using ember s and edit syn-shared addon .ts files, I get updated js files.

What happened instead?

recompilation for file inside syn-shared folder don't happening

Debugging:

looks like ember-cli-typescript\js\lib\incremental-typescript-compiler\index.js watchedFileChanged callback not called after addon files changed

changing ember-cli-typescript\js\lib\utilities\compile.js buildIgnoreDefs function from

function buildIgnoreDefs(rootDir, patterns) {
    let base = escapeRegex(rootDir);
    let sep = `[/\\\\]`;
    return [ '**/node_modules/**' ,
        new RegExp(`^${base}${sep}(${patterns.join('|')})${sep}`, 'i')
    ];
}

to this:

function buildIgnoreDefs(rootDir, patterns) {
    let base = escapeRegex(rootDir);
    let sep = `[/\\\\]`;
    return [ rootDir.includes('syn-shared') ? undefined : '**/node_modules/**' ,
        new RegExp(`^${base}${sep}(${patterns.join('|')})${sep}`, 'i')
    ].filter(a=>a);
}

this also working

function buildIgnoreDefs(rootDir, patterns) {
    let base = escapeRegex(rootDir);
    let sep = `[/\\\\]`;
    return [
      rootDir.includes('syn-shared') ? '**syn-shared/node_modules**' : '**/node_modules/**' ,
        new RegExp(`^${base}${sep}(${patterns.join('|')})${sep}`, 'i')
    ].filter(a=>a);
}

solve recompilation problen

looks like this is an kinda regression from https://github.com/typed-ember/ember-cli-typescript/pull/223

Most helpful comment

Hey @theseyi, this is not the issue that I am having. My problem is that is not able to pick up the types without doing yarn workspaces run prepublish. Needs more investigation on my side.

All 4 comments

Cannot reproduce it in "ember-cli-typescript": "^2.0.0-beta.3"

Closing as resolved in v2!

@igbopie we鈥檙e you able to reproduce?

Hey @theseyi, this is not the issue that I am having. My problem is that is not able to pick up the types without doing yarn workspaces run prepublish. Needs more investigation on my side.

Was this page helpful?
0 / 5 - 0 ratings