Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darekf77/isomorphic-region-loader
Strip off code inside #regions from your bundle and be happy with your isomorphic javascript/typescipt apps.
https://github.com/darekf77/isomorphic-region-loader
isomorphic isomorphic-javascript javascript typescript webpack-loader
Last synced: 9 days ago
JSON representation
Strip off code inside #regions from your bundle and be happy with your isomorphic javascript/typescipt apps.
- Host: GitHub
- URL: https://github.com/darekf77/isomorphic-region-loader
- Owner: darekf77
- Created: 2017-12-30T22:34:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-25T02:19:33.000Z (about 1 month ago)
- Last Synced: 2024-11-25T03:22:10.040Z (about 1 month ago)
- Topics: isomorphic, isomorphic-javascript, javascript, typescript, webpack-loader
- Language: TypeScript
- Size: 6.04 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Isomorphic #region Loader
A loader for webpack that lets you strip #regions code from bundle.
Install
```bash
npm install --save-dev isomorphic-region-loader
```Usage
This load is very helpfull if you wanna write isomorphic applications
in javascript or typescript. Just specify **region** and this loader will
cut it from bundle. Example:```ts
import * as jquery from 'jquery'
//#region nodejs
import * as fs from 'fs'
//#endregionclass ExampleIsomorphicClass {
...
}```
With webpack configuraiton below:
```js
module.exports = {
module: {
rules: [
{
test: /\.ts$/,
use: 'isomorphic-region-loader',
options: { platform: 'browser' } // 'borwser' default platform, also there is 'nodejs'
}
]
}
}
```
You will get:
```ts
import * as jquery from 'jquery'class ExampleIsomorphicClass {
...
}```
As result, code inside **#region nodejs** has been stripped.
Also you can do similar things to your nodejs code and strip off
browser things.### Inline
**In your application**
```js
import { ExampleIsomorphicClass } from '!isomorphic-region-loader!./isomorphic-class.ts';
```