Skip to content
This repository was archived by the owner on Jan 3, 2019. It is now read-only.

Commit 19fa9b2

Browse files
committed
Support Webpack 4
Hack around webpack/webpack#7057 Fixes #5
1 parent c8aad30 commit 19fa9b2

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎example/package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
"author": "Eemeli Aro <[email protected]>",
1313
"license": "MIT",
1414
"dependencies": {
15-
"messageformat": "^1.0.2",
15+
"messageformat": "^1.1.1",
1616
"messageformat-loader": "file:../",
17-
"webpack": "^3.8.1"
17+
"webpack": "^4.1.1",
18+
"webpack-cli": "^2.0.12"
1819
}
1920
}

‎example/src/messages.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
messages.js

‎index.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
var loaderUtils = require('loader-utils');
22
var MessageFormat = require('messageformat');
3+
var JavascriptParser = require('./example/node_modules/webpack/lib/Parser');
4+
var JavascriptGenerator = require('./example/node_modules/webpack/lib/JavascriptGenerator');
35

46
module.exports = function(content) {
57
var options = loaderUtils.getOptions(this);
@@ -27,5 +29,12 @@ module.exports = function(content) {
2729
this.cacheable && this.cacheable();
2830
this.value = [ messageFunctions ];
2931

32+
// BEGIN HACK
33+
// for https://github.com/webpack/webpack/issues/7057
34+
this._module.type = 'javascript/auto';
35+
this._module.parser = new JavascriptParser();
36+
this._module.generator = new JavascriptGenerator();
37+
// END HACK
38+
3039
return messageFunctions.toString('module.exports');
3140
};

0 commit comments

Comments
 (0)