Comments (4)
Thanks, I made some progress.
I had to add a console.log(ast.body)
to check the structure, maybe considering adding an option to output that data would help people configuring their moduleAst parameter.
console.log(ast.body) output:
Node {
type: 'ExpressionStatement',
start: 0,
end: 2418,
expression:
Node {
type: 'UnaryExpression',
start: 0,
end: 2417,
operator: '!',
prefix: true,
argument:
Node {
type: 'CallExpression',
start: 1,
end: 2417,
callee: [Object],
arguments: [Object] } } }
So I ended up with the following config:
{
"type": "browserify",
"knownPaths": {},
"entryPoint": "ast.body[0].expression.argument.arguments[2].elements[0].value",
"moduleAst": ["body", 0, "expression", "argument", "arguments", 0]
}
With my bundle, I get the following output with still an error:
* Reading bundle...
* Decoding modules...
* Discovered module 1
* Extracted module code for 1
* Extracted module lookup table for 1
* Calculated module lookup table for 1
* Discovered module 2
* Extracted module code for 2
* Extracted module lookup table for 2
* Calculated module lookup table for 2
* Reassembling requires...
* Replacing e with 'module'...
* Replacing i with 'exports'...
* Replacing e with 'module'...
* Replacing i with 'exports'...
* Resolving files...
/usr/local/lib/node_modules/debundle/src/utils/getModulePath.js:8
throw new Error(`Module ${mod.id} cannot be found in the module array.`);
TypeError: Cannot read property 'id' of undefined
at makeModuleTree (/usr/local/lib/node_modules/debundle/src/utils/getModulePath.js:8:34)
at getModuleLocation (/usr/local/lib/node_modules/debundle/src/utils/getModuleLocation.js:17:14)
at modules.map.i (/usr/local/lib/node_modules/debundle/src/lookupTable.js:14:17)
at Array.map (native)
at lookupTableResolver (/usr/local/lib/node_modules/debundle/src/lookupTable.js:10:18)
at Object.<anonymous> (/usr/local/lib/node_modules/debundle/src/index.js:126:15)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
from debundle.
Entrypoint should be the id of the module that is at the top of the module tree. See https://github.com/1egoman/debundle/blob/master/DOCS.md#entrypoint-required-for-webpack-bundles
In the bundle here, I believe your entrypoint is the module with the id of 1
.
Try something like this:
{
"type": "browserify",
"knownPaths": {},
"entryPoint": 1,
"moduleAst": ["body", 0, "expression", "argument", "arguments", 0]
}
Also, the docs and error messages for this project could be improved. If you have any suggestions, I'd appreciate if you could either leave an issue or contribute better versions. Unfortunately I don't have time right now to devote to this project. 😦
from debundle.
Your moduleAST
variable is set incorrectly. See https://github.com/1egoman/debundle/blob/master/DOCS.md#moduleast
from debundle.
No problem.
With your config it works correctly.
Unfortunatly, the debundle does not return a clean es6 class just like here: https://gist.github.com/SamVerschueren/233d48892f6ba88be4a8768dc4fc5886
Anyway I greatly appreciate your help, thanks again.
from debundle.
Related Issues (20)
- Module AST Failed HOT 7
- Variables renaming HOT 4
- Error while running the sample HOT 5
- Error: did not recognize object of type "AssignmentPattern" HOT 7
- Infer webpack module names from import constants names HOT 2
- not work in windows!
- Cannot read property 'element' of underfined HOT 2
- Can you give me an webpack example? HOT 2
- How to recover a built file to its original source
- hello, HOT 1
- Potential reownership? HOT 22
- how debundle multi files such as mainifest.js vendor.js app.js HOT 1
- Cannot read property 'id' of undefined HOT 2
- How to set the debundle.config.json
- Support for webpackJsonp HOT 2
- TypeError: Cannot read properties of undefined (reading 'elements') at Object.<anonymous> (/usr/local/lib/node_modules/debundle/src/index.js:63:59)
- Hi there! HOT 1
- The root level IIFE didn't have an array for it's first parameter, aborting... HOT 5
- Error: Locating the module AST failed. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from debundle.