Comments (8)
Are you sure that you are including tsify
as a plugin correctly? Those imports look correct, and the error message is what I would expect if the input got to browserify
without being compiled to Javascript first. What does your build setup look like?
from tsify.
ah, i don't have the exact setup as i've since overwritten it to something that precompiles the typescript before handing it to browserify. But to recreate the tsify implementation, it was something like:
glob('./src/away/**/*.ts', {}, function (error, files) {
var b = browserify({
debug: true,
paths: ['./src']
});
files.forEach(function (file) {
b.require(file, {expose:path.relative('./src', file.slice(0,-3))});
});
b.plugin('tsify', { target: 'ES5' })
.bundle()
.pipe(source('awayjs-core.js'))
.pipe(gulp.dest('./build'));
callback();
});
Is it possibly todo with the fact that i'm adding classes using require()
rather than add()
? The latter isn't possible for me due to the fact that the classes have to be exposed for external use in an implementing application
from tsify.
Oh, that's an interesting setup. Yeah, that could very well be the culprit.
I'll try it out when I get back to my dev box.
One other thing that comes to mind immediately is that every file passed to
Browserify is considered an entry point, sort of like including each file
as a script tag. That's not really ideal because you might end up with
script ordering issues just like if you didn't use Browserify at all. So I
haven't really tested that scenario.
On Oct 1, 2014 6:38 PM, "Rob Bateman" [email protected] wrote:
ah, i don't have the exact setup as i've since overwritten it to something
that precompiles the typescript before handing it to browserify. But to
recreate the tsify implementation, it was something like:glob('./src/away/*/.ts', {}, function (error, files) {
var b = browserify({
debug: true,
paths: ['./src']
});files.forEach(function (file) { b.require(file, {expose:path.relative('./src', file.slice(0,-3))}); }); b.plugin('tsify', { target: 'ES5' }) .bundle() .pipe(source('awayjs-core.js')) .pipe(gulp.dest('./build')); callback();
});
Is it possibly todo with the fact that i'm adding classes using require()
rather than add ?—
Reply to this email directly or view it on GitHub
#11 (comment).
from tsify.
yeah i was initially worried about that too but to its credit browserify doesn't have any trouble with this approach as far as i can tell. Things run great, even with my code mess ;)
thanx for taking a look, be keen to see if a pure browserify implementation is possible as it would open the door to other possibilities like using watchify on my codebase
from tsify.
Oh, I take it back! Never respond to issues while drinking margaritas. :)
Using require
instead of add
means that no file is added as an entry
point, unless you pass the option entry: true
. I'm not totally sure what
that actually means once the whole bundle is put together, but tsify looks
at the entry point(s) to determine what to compile, so that totally
explains the ultimate behavior you saw. I'll figure out what it should do
soon. Thanks for reporting, I'll figure this one out.
from tsify.
I fixed a small error on this end, but ultimately this issue is caused by browserify/browserify#937. Blocking on resolution of this issue. In the meantime, specify at least one file as an entry point!
from tsify.
aha! ok interesting, will try it out. thanks for the update
from tsify.
Fixed way upstream in [email protected]! No more hacks needed.
from tsify.
Related Issues (20)
- Error FileReader on Ionic 3 HOT 1
- Compile errors when using from Docker. HOT 1
- Dont wrap bundle inside anonymous function HOT 4
- Cannot find module with @types import HOT 6
- Any plan to support --incremental flag? HOT 11
- Module aliasing not supported HOT 2
- Cannot find ambient module declaration in .d.ts HOT 7
- importing css causes problems HOT 2
- how to select which files to compile? HOT 2
- TSify is a brilliant tool, thank you guys
- Compiler Opions Error - updating to 4.0.2 from 4.0.1 HOT 7
- Importing nodejs types pollutes global types HOT 2
- tsconfig-files with `composite` set to true fail to build HOT 6
- TypeScript types are likely incorrect HOT 4
- The "path" argument must be of type string. Received undefined HOT 1
- Tsify generates own import types (type_1 instead of type) and uses these types in ts transformed code
- Can't install on npm 7
- Using filesystems with mixed case sensitivity breaks build
- Can't parse ES2020 or higher HOT 1
- Failing to parse expression with null coalescing HOT 1
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 tsify.