-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standard package.json key for .ts files #12561
Comments
Summary: I checked out a fresh copy of the repo to ensure that it could pass CI. Here are the changes I made: - Moved the CI scripts from .travis.yml to package.json for consistency. It's nice to be able to type `yarn run ci` to run the same suite as Travis. - Ran `build` before `test`, to ensure any intra-repo dependencies are available in the dist folder for their siblings, as prescribed in package.json. If we had something like typescript:main, we could skip this step (microsoft/TypeScript#12561). - Fixed all the errors the linter complained about. Since a few packages were written before the linter existed, there were conflicts between their style and its. Reviewers: O3 Material JavaScript platform reviewers, #material_motion, O2 Material Motion, markwei Reviewed By: #material_motion, O2 Material Motion, markwei Tags: #material_motion Differential Revision: http://codereview.cc/D2395
This may be a |
Side note (in case anyone else references the OP): the |
@blakeembrey fixed. |
I have this working in both Pundle (http://codereview.cc/D2470) and Webpack (http://codereview.cc/D2472). And I'm considering opening PRs against RxJS, Cycle, xstream, and Angular to test it with common packages. |
I don't see the harm in it, but I'm not sure whether or not I understand the implications.
The thing is that if I'm not mistaken, this will still require a full type-check across all of your code (though it can avoid scanning/parsing/binding/sometimes emitting for individual files). @mhegazy is that correct? |
I do not think sharing sources between projects is something i would recommend. .d.ts files are meant for the sharing scenario. |
I'm looking at adding Vite to my workflow, and once again this seems like a good solution. Here's the problem: Vite shortcircuits typechecking to make UI iteration faster. To do that, it needs to know what sources you have under control, so it can watch them for changes without waiting for It appears Vite has a |
That's how I ended up adding Vite to my monorepo.
When |
A common TypeScript module structure looks like this:
and a
package.json
that looks like this:There's a convention to use the package.json key
jsnext:main
to point to a variant ofmain
that uses ES2015 module syntax. Can we develop a similar convention to point at.ts
files, e.g.typescript:main
?Consider a TypeScript project that is sharded across many microlibraries (e.g.
my-project-core
,my-project-thing-plugin
,my-project-other-thing-plugin
). I'd like to be able to configure my bundler to import fromsrc/*.ts
files for any module whose name starts withmy-project
. Otherwise, it will be looking indist/*.js
and I'll have to rebuild the plugins any time I make changes in them.Of course, I could use
jsnext:main
for this purpose now, but any consumers who aren't using TypeScript would get syntax errors for any files that contained TS-specific syntax like types. Similarly, I could make up my own package.json key and configure my bundler to look there first, but it behooves the community to have a convention here. That will allow bundlers like Webpack, Browserify, Rollup, and Pundle to look in the right place by default.The text was updated successfully, but these errors were encountered: