I'm running into an issue where fuse-box isn't correctly transpiling statements like:
export const { A, B } = .... The exports are completely ignored.
If I do:
const { A, B } = ...
export { A, B };
then things seem fine.
Example:
fuse.ts
import {fusebox} from "fuse-box";
const fuse = fusebox({
entry: "src/index.ts",
target: "browser",
devServer: {
enabled: true,
httpServer: {
port: 8080
},
hmrServer: {
port: 8081
}
},
webIndex: true,
// Enable hot module replace
hmr: true,
});
fuse.runDev({
bundles: {
distRoot: "dist",
app: "bundle.js"
}
});
src/Test.ts
const Stuff = {
A: 1,
B: () => { console.log("B") },
C: () => { console.log("C") }
}
export const { B, C } = Stuff;
export const Doit = () => { B() }
src/index.ts
import { Doit } from "./Test";
Doit();
Relevant snippets from generated bundle.js
__fuse.bundle({
// src/index.ts @1
1: function(__fusereq, exports, module){
exports.__esModule = true;
var Test_1 = __fusereq(4);
Test_1.Doit();
},
and
// src/Test.ts @4
4: function(__fusereq, exports, module){
exports.__esModule = true;
const Stuff = {
A: 1,
B: () => {
console.log("B");
},
C: () => {
console.log("C");
}
};
exports.undefined = Stuff;
exports.Doit = () => {
B();
};
},
Issues:
exports.undefined = Stuff -- stuff wasn't exported in the original code
- missing exports and corrected references for
export { B, C } = Stuff
Further, I get the following error when I try to open this in the browser:
index.ts:3 Uncaught TypeError: Test_1.Doit is not a function
at 1 (index.ts:3)
at Object.f.r (bundle.js:24)
at Test.ts:9
at Object.f.bundle (bundle.js:10)
at bundle.js:28
I'm running into an issue where fuse-box isn't correctly transpiling statements like:
export const { A, B } = .... The exports are completely ignored.If I do:
then things seem fine.
Example:
fuse.ts
src/Test.ts
src/index.ts
Relevant snippets from generated bundle.js
and
Issues:
exports.undefined = Stuff-- stuff wasn't exported in the original codeexport { B, C } = StuffFurther, I get the following error when I try to open this in the browser: