Skip to content

Commit bb6d362

Browse files
authored
Merge pull request #118 from javascript-obfuscator/fixed-stage
Changed `processAssets` stage
2 parents ed369f5 + b7ed8b3 commit bb6d362

7 files changed

+1210
-15849
lines changed

package-lock.json

Lines changed: 1194 additions & 15845 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-obfuscator",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"description": "javascript-obfuscator plugin for Webpack@5",
55
"keywords": [
66
"obfuscator",
@@ -30,8 +30,8 @@
3030
"javascript-obfuscator": "^2.8.0",
3131
"source-map": "^0.7.3",
3232
"typescript": "^4.0.3",
33-
"webpack": "^5.1.0",
34-
"webpack-cli": "^4.0.0"
33+
"webpack": "^5.37.0",
34+
"webpack-cli": "^4.7.0"
3535
},
3636
"repository": {
3737
"type": "git",

plugin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class WebpackObfuscatorPlugin {
5353
compilation.hooks.processAssets.tap(
5454
{
5555
name: 'WebpackObfuscator',
56-
stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
56+
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
5757
},
5858
(assets) => {
5959
let identifiersPrefixCounter: number = 0;

test/config/javascript-obfuscator-loader.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path');
44
const WebpackObfuscatorPlugin = require('../../dist/index');
55

66
module.exports = {
7+
mode: 'production',
78
entry: {
89
'index': './test/input/index.js',
910
'index-excluded': './test/input/index-excluded.js'

test/config/javascript-obfuscator-plugin.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
'use strict';
22

3+
const webpack = require('webpack');
34
const WebpackObfuscatorPlugin = require('../../dist/index');
45

56
module.exports = {
7+
mode: 'production',
68
entry: {
79
'index': './test/input/index.js',
810
'index-excluded': './test/input/index-excluded.js'
@@ -13,6 +15,9 @@ module.exports = {
1315
extensions: ['.js']
1416
},
1517
plugins: [
18+
new webpack.DefinePlugin({
19+
'process.env.SOME_VAR': JSON.stringify('some-value'),
20+
}),
1621
new WebpackObfuscatorPlugin({
1722
disableConsoleOutput: false,
1823
sourceMap: true,

test/input/index-excluded.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ require('./nested');
1010
abc('a');
1111

1212
console.log(test);
13+
14+
var processEnv = process.env.SOME_VAR;
15+
console.log(processEnv);
1316
})();

test/input/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ require('./nested');
1010
abc('a');
1111

1212
console.log(test);
13+
14+
var processEnv = process.env.SOME_VAR;
15+
console.log(processEnv);
1316
})();

0 commit comments

Comments
 (0)