extract-loader
Advanced tools
Comparing version 0.0.2 to 0.1.0
@@ -15,2 +15,4 @@ "use strict"; | ||
var _loaderUtils = require("loader-utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -45,2 +47,4 @@ | ||
var callback = this.async(); | ||
var query = (0, _loaderUtils.parseQuery)(this.query); | ||
var publicPath = typeof query.publicPath !== "undefined" ? query.publicPath : this.options.output.publicPath; | ||
var dependencies = []; | ||
@@ -91,3 +95,3 @@ var script = new _vm2.default.Script(content, { | ||
function (src, i) { | ||
return runModule(src, dependencies[i], _this.options.output.publicPath); | ||
return runModule(src, dependencies[i], publicPath); | ||
}); | ||
@@ -94,0 +98,0 @@ }).then(function (results) { |
{ | ||
"name": "extract-loader", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "webpack loader to extract HTML and CSS from the bundle", | ||
@@ -47,3 +47,6 @@ "main": "lib/extractLoader.js", | ||
"webpack": "^1.12.13" | ||
}, | ||
"dependencies": { | ||
"loader-utils": "^0.2.16" | ||
} | ||
} |
@@ -131,5 +131,31 @@ extract-loader | ||
The are currently no options.<br> | ||
You need one? Then you should think about: | ||
There is currently exactly one option: `publicPath`. | ||
If you are using a relative `publicPath` in webpack's [output options](http://webpack.github.io/docs/configuration.html#output-publicpath) and extracting to a file with the `file-loader`, you might need this to account for the location of your extracted file. | ||
Example: | ||
```js | ||
module.exports = { | ||
output: { | ||
path: path.resolve( './dist' ), | ||
publicPath: 'dist/' | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.css$/, | ||
loaders: [ | ||
// target file: dist/assets/file.css | ||
"file?name=assets/[name].[ext]", | ||
// back up one directory to reach "dist/" | ||
"extract?publicPath=../", | ||
"css" | ||
] | ||
} | ||
] | ||
} | ||
}; | ||
``` | ||
You need another option? Then you should think about: | ||
<br> | ||
@@ -136,0 +162,0 @@ |
import vm from "vm"; | ||
import path from "path"; | ||
import { parseQuery } from "loader-utils"; | ||
@@ -29,2 +30,4 @@ /** | ||
const callback = this.async(); | ||
const query = parseQuery(this.query); | ||
const publicPath = typeof query.publicPath !== "undefined" ? query.publicPath : this.options.output.publicPath; | ||
const dependencies = []; | ||
@@ -64,3 +67,3 @@ const script = new vm.Script(content, { | ||
// runModule may throw an error, so it's important that our promise is rejected in this case | ||
(src, i) => runModule(src, dependencies[i], this.options.output.publicPath) | ||
(src, i) => runModule(src, dependencies[i], publicPath) | ||
)) | ||
@@ -67,0 +70,0 @@ .then(results => sandbox.module.exports.toString() |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23962
244
178
1
+ Addedloader-utils@^0.2.16
+ Addedbig.js@3.2.0(transitive)
+ Addedemojis-list@2.1.0(transitive)
+ Addedjson5@0.5.1(transitive)
+ Addedloader-utils@0.2.17(transitive)
+ Addedobject-assign@4.1.1(transitive)