https://github.com/zodern/meteor-import-extension-order
Configure order of extensions in Meteor's resolver
https://github.com/zodern/meteor-import-extension-order
Last synced: 8 months ago
JSON representation
Configure order of extensions in Meteor's resolver
- Host: GitHub
- URL: https://github.com/zodern/meteor-import-extension-order
- Owner: zodern
- Created: 2024-02-19T21:00:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-19T21:04:42.000Z (over 2 years ago)
- Last Synced: 2024-10-19T15:15:55.853Z (over 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# zodern:import-extension-order
Configure the order extensions are tried by Meteor when resolving an imported file without an extension.
Compatible with Meteor 2 and newer.
For example:
```
import '/imports/ui/button';
```
Normally, Meteor would first check for a `button.js`, `button.json`, then a `button.html` file, and so on.
If there are both `button.html` and `button.ts` files, Meteor would import the html file.
This package allows changing the order Meteor tries extensions, so you can prioritize `.ts` or other extensions.
## Usage
1. Add the package with `meteor add zodern:import-extension-order`
2. Configure the extension order. Update the `meteor` object in your package.json file:
```json
{
"meteor": {
"mainModule": {
"client": "client/main.tsx",
"server": "server/main.ts"
},
"testModule": "tests/main.js",
"extensions": [".js", ".ts", ".jsx", ".tsx", ".html", ".css"]
}
}
```
If Meteor finds an extension that is not listed in the config, the package will log a message to let you know.