webcrack icon indicating copy to clipboard operation
webcrack copied to clipboard

Webpack refactor

Open j4k0xb opened this issue 2 years ago • 15 comments

closes https://github.com/j4k0xb/webcrack/issues/6 closes https://github.com/j4k0xb/webcrack/issues/30 closes #33 closes #66 closes #68 closes #95

supersedes #31

Deploy Preview: deploy-preview-50--webcrack.netlify.app

j4k0xb avatar Jan 13 '24 02:01 j4k0xb

Deploy Preview for webcrack ready!

Name Link
Latest commit 4cc7b2cc816027333c66ce5a5c7917a8c8fe8c52
Latest deploy log https://app.netlify.com/sites/webcrack/deploys/65b7fabe3dd73b000815526e
Deploy Preview https://deploy-preview-50--webcrack.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jan 13 '24 02:01 netlify[bot]

Should also strip the __esModule property? This still got emitted currently:

Object.defineProperty(exports, "__esModule", {
  value: true
});

mochaaP avatar Jan 13 '24 11:01 mochaaP

Also, these JSON imports and external imports weren't resolved as they should? They still emit a .js file instead of .json or inlining the import image

mochaaP avatar Jan 13 '24 12:01 mochaaP

Should also strip the __esModule property? This still got emitted currently:

Done

Also, these JSON imports and external imports weren't resolved as they should? They still emit a .js file instead of .json or inlining the import

emitting .json is now also implemented externals are properly resolved (by ignoring) but not inlined yet

j4k0xb avatar Jan 13 '24 16:01 j4k0xb

also, export statements aren't transformed. they are firstly all initialized within a single VariableAssignment to undefined, then get assigned the actual value later.

mochaaP avatar Jan 13 '24 20:01 mochaaP

thats specific to typescript: https://www.typescriptlang.org/play?module=1#code/KYDwDg9gTgLgBAG2PAhnAvHAjAbiA this PR is mostly about fixing the webpack issues themselves but it could be implemented later

j4k0xb avatar Jan 13 '24 20:01 j4k0xb

acked

mochaaP avatar Jan 13 '24 20:01 mochaaP

Externals are inlined now:

// 0: module.exports = require("worker_threads");
// 1: var tmp = __webpack_require__(0); ...
// 1 gets changed to:
import { MessageChannel, parentPort, Worker, workerData } from "worker_threads";

And import/export paths are properly resolved again for existing modules: import * as json from "./1.json"; instead of import * as json from "1";

j4k0xb avatar Jan 15 '24 00:01 j4k0xb

:thinking: is anything still blocking this pr?

mochaaP avatar Jan 28 '24 20:01 mochaaP

yeah there are a couple issues like creating multiple conflicting import { a } from didn't have much time recently to work on it

j4k0xb avatar Jan 28 '24 20:01 j4k0xb

👌

mochaaP avatar Jan 28 '24 20:01 mochaaP

yeah there are a couple issues like creating multiple conflicting import { a } from didn't have much time recently to work on it

my few cents: generate names like import { a as a$chunkId$ } from './chunkId.js';

mochaaP avatar Jan 28 '24 20:01 mochaaP

interestingly when enable the mangle option its cause an error 🤔

obfuscated.txt https://github.com/j4k0xb/webcrack/assets/131268899/c30c8aa3-0b6e-4fef-af9f-6916810920e3

also it isnt unbundle files

youdie323323 avatar Jun 14 '24 22:06 youdie323323