Comments (6)
You can also add a paths to your tsconfig to specify a mapping to a different location.
"paths": { "npm:ts-mockito" : ["./node_modules/ts-mockito"] }
from ember-cli-typescript.
Yes! I ran into that solution earlier today and was just coming here to suggest it. That’s the solution I’ll be recommending going forward.
from ember-cli-typescript.
I found a solution without browserify, but I prefer a solution with browserify (to avoid the next shims) ;-) :
npm install --save @types/ramda
ember install ember-cli-import-from-npm
in ember-cli-build.js:
app.import(app.nodeModulesDirectory + '/ramda/dist/ramda.js');
app.import('vendor/shims/ramda.js');
and in vendor/shims/ramda.js:
(function() {
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function vendorModule() {
'use strict';
return _extends({}, { 'default': R}, R);
}
define('ramda', [], vendorModule);
})();
an idea?
from ember-cli-typescript.
@wooandoo just wanted you to know as I'm picking up steam on working on this that I've seen this. I'm not yet sure what the answer here will be, and it'll be a bit before I have time to look at it, but it's on my radar and I will get back to it!
from ember-cli-typescript.
hello,
have you an alternative to load NPM modules from typescript file (without browerify?)
how can I help?
Frédéric
from ember-cli-typescript.
You can use ember-browserify
with a small shim. For example (drawing on the notes I wrote up for #78), you could import the ts-mockito
module using ember-browserify in parallel with TypeScript by creating a TypeScript shim module named npm:ts-mockito
which simply imports and re-exports the ts-mockito
exports. Something like this should work (I haven’t tested it, though!):
declare module 'npm:ts-mockito' {
import mockito from 'ts-mockito';
export default mockito;
}
from ember-cli-typescript.
Related Issues (20)
- ember install ember-cli-typescript does not set eslint parser to @typescript-eslint/parser HOT 2
- Provide CLI option for `tsconfig.json` path to allow different config per env HOT 1
- Type for location missing in Routing types HOT 2
- Type-checking failure in node_modules on a fresh Ember app HOT 6
- No declaration files output during precompile HOT 3
- Can subclass declarations include the inherited aspects of the base class? HOT 3
- Typechecker eats 70% of CPU when idle HOT 2
- `AsyncHasMany` resolves to `ArrayProxy`, can't access `reload`/`createRecord` methods on resolved promise HOT 2
- Make sure docs are up to date for Signature usage HOT 1
- Cant find `meta` on `PromiseManyArray` HOT 4
- Broken with Embroider 1.9.0 HOT 1
- "@ember/test-helpers/setup-rendering-context"' has no exported member named 'rerender'. Did you mean 'render'? HOT 1
- memory leak of ts errors HOT 1
- bug: when `moduleName` and `package.name` differ, types will not be generated by default HOT 1
- Incompatible ECMAScript version being used during the build HOT 1
- Newly generated component is not buildable: Property 'element' does not exist on type 'TestContext' HOT 2
- Issue when building ember app with exports from GTS file into TS file HOT 2
- Warnings when using ember-cli-babel 8.x HOT 1
- Switch to maintenance mode HOT 18
- v6 release: the last major? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-typescript.