closure-loader
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -10,3 +10,2 @@ var loaderUtils = require("loader-utils"), | ||
module.exports = function (source) { | ||
@@ -21,2 +20,3 @@ var query = loaderUtils.parseQuery(this.query), | ||
config = buildConfig(query, this.options[query.config || "closureLoader"]); | ||
provideMap = mapBuilder(config.paths); | ||
@@ -28,4 +28,2 @@ | ||
//console.log(source); | ||
return source; | ||
@@ -104,3 +102,7 @@ }; | ||
function createRequire(key, localVar, provideMap) { | ||
if (!provideMap[key]) { | ||
throw new Error("Can't find closure dependency " + key); | ||
} | ||
return "googRequire('" + key + "', " + localVar + "); " + key + " = require('" + provideMap[key] + "')." + key; | ||
} |
{ | ||
"name": "closure-loader", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Webpack loader for google closure library dependencies", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,4 +27,4 @@ # Closure library dependency loader for [Webpack](http://webpack.github.io/) | ||
**NOTE**: Usually the closure lib simply creates all namespaces on the *global* scope (i.e. the window object). | ||
This is *not* the case if you use this loader. Every file ("module") has its own scope just like it would have | ||
**NOTE**: Usually the closure lib simply creates all namespaces on the **global** scope (i.e. the window object). | ||
This is **not** the case if you use this loader. Every file ("module") has its own scope just like it would have | ||
if you used CommonJS syntax. | ||
@@ -103,5 +103,5 @@ | ||
Here are the configuration options specific for this loader: | ||
- *paths* (array): An array of path strings. The loader will search all `*.js` files within theses | ||
- **paths** (array): An array of path strings. The loader will search all `*.js` files within theses | ||
paths for `goog.provide()` statements. | ||
- *es6mode* (boolean, default: false): If enabled it will add the value of the first `goog.provide()` | ||
- **es6mode** (boolean, default: false): If enabled it will add the value of the first `goog.provide()` | ||
as default export for usage with babel. For this reason it will also export the corresponding flag | ||
@@ -108,0 +108,0 @@ `module.exports.__esModule = true` |
Sorry, the diff of this file is not supported yet
35217
128