Awesome Open Source
Awesome Open Source

Webpack loader for Surplus applications

Installation

> npm install --save-dev surplus-loader

Usage

// webpack.config.js
...
module: {
    rules: [
        // if just using javascript
        { test: /\.jsx$/, loader: 'surplus-loader' },
        // if using with typescript
        { test: /\.tsx?$/, loader: 'surplus-loader!ts-loader' },
    ]
}
...

Here's an example of an entire webpack.config.js that uses typescript.

// webpack.config.js
module.exports = {
    entry: './src/main.ts',
    output: {
        filename: './dist/main.js'
    },
    resolve: {
        extensions: ['.ts', '.tsx', '.js']
    },
    module: {
        rules: [
            { test: /\.tsx?$/, loader: 'surplus-loader!ts-loader' },
        ]
    }
};

Note:

  1. surplus-loader runs after typescript, so that it's just compiling Javascript, not Typescript (surplus-preprocessor doesn't understand typescript).
  2. For the JSX to make it through typescript uncompiled, you must specify "jsx": "preserve" in your tsconfig.json.
Alternatives To Surplus Loader
Select To Compare


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,048,460
Typescript (239,577
Webpack (23,595
Jsx (4,195
Preprocessor (1,596
Webpack Loader (815