0.1.8 • Published 8 years ago

worker-static-loader v0.1.8

Weekly downloads
2
License
-
Repository
github
Last release
8 years ago

worker loader for webpack with static path

Forked from https://github.com/webpack/worker-loader

Differences: This loader will add the path of your static files folder when loading the worker js file

Installation

npm i worker-static-loader

Usage

Documentation: Using loaders

Import the worker file:

// main.js
var MyWorker = require("worker-static-loader?{'staticPath':'##PATH_TO_STATIC_FOLDER##'}!./file.js");

var worker = new MyWorker();
worker.postMessage({a: 1});
worker.onmessage = function(event) {...};
worker.addEventListener("message", function(event) {...});

The worker file can import dependencies just like any other file:

// file.js
var _ = require('lodash')

var o = {foo: 'foo'}

_.has(o, 'foo') // true

You can even use ES6 modules if you have the babel-loader configured:

// file.js
import _ from 'lodash'

let o = {foo: 'foo'}

_.has(o, 'foo') // true

License

MIT (http://www.opensource.org/licenses/mit-license.php)

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago