webpack
Bloat loader forbloat-loader is a webpack loader that will replace all import declarations with the requested file's source code. Effectively, bloating your code from this:
;const instance = ;instance;
...to something like this:
{thisfoo = 'bar';}{return thisfoo;}const instance = ;instance;
Currently Supported Syntax (v0.4.0):
Directly import the default:
import myDefault from 'my-module'
Import a single member of a module:
import { myMember } from 'my-module'
Import multiple members of a module:
import { foo, bar } from 'my-module'
Import a member with a more convenient alias:
import { reallyReallyLongModuleMemberName as shortName } from 'my-module'
Import multiple members of a module with aliases:
import { reallyReallyLongModuleMemberName as shortName, anotherLongModuleName as short } from 'my-module'
Import an entire module's contents:
import * as myModule from 'my-module'
See the bloat-loader feature roadmap for more information on upcoming syntax support.
Install
Via npm install
npm install bloat-loader --save-dev
Requirements
bloat-loader uses ES2015+ features and requires Node 4.4.5 or above
Usage
Intended Usage
This loader should (probably) never be applied to an entire project and is intended for use cases where compiling a class or method's dependencies into one source is particularly useful (e.g. when creating a Bookmarklet).
Apply via webpack config
moduleexports =...module:loaders:test: /\.js$/loaders: 'bloat-loader'include: path;
When using Babel or another transpiler, bloat-loader must be applied beforehand so that it's result can be transpiled:
...loaders: 'babel' 'bloat-loader'...