Open Vadorequest opened 2 years ago
Are you using bundler?
I tried reproducing it, but failed, and the only code which can create __default
is in the bundler, if I remember correctly
What I did in the meantime was to use require
instead.
Ah, I changed the repo visibility to private since creating this issue.
spack.config.js
const fs = require('fs');
const { config } = require('@swc/core/spack');
// Use the same options for spack as the ones in the .swcrc file (better intellisense there)
const options = JSON.parse(fs.readFileSync('.swcrc', { encoding: 'utf8', flag: 'r' }));
module.exports = config({
entry: {
'univers': __dirname + '/src/Stacker X - [PPO] Plateforme Univers - univers.propulseo.unly.org/index.ts',
},
output: {
path: __dirname + '/dist',
},
module: {},
mode: 'production',
target: 'browser',
options,
});
Here's a pretty straightforward repro gist https://gist.github.com/Stuk/4e1c11e867c720608a1c7bee129654ca. Specifically in the output the following incorrect line appears:
return __default.createElement("div", null, hour, ":", minute, ":", second);
+1 , is there any way to resolve it ?
This is becoming more and more of a daily issue, I cannot use TypeScript properly.
const NcoUser = require('../../types/NcoUser').default;
const user: typeof NcoUser = findNcoUser();
What I really want is to take a bunch of JS/TS files and make a single dist file that's browser-compatible, I feel like I'm using the wrong solution.
Is this on the roadmap? I'm looking for a tool that allows bundling different output files (like Spack does), but I'd prefer using TS and Import, which is currently not possible.
Describe the bug
When importing a file with named exports, the function code isn't present in the output. A
__default
call is present but doesn't reference anything.Input code
Config
Playground link
https://github.com/UnlyEd/stacker-public-scripts/blob/issue-_default/spack.config.js
Expected behavior
The function
findStackerUser
is not present in the output, it should be.Actual behavior
Yield the following output:
Version
1.2.142
Additional context
No response