Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions demo/public/cjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { h } = require('preact');

console.log(h);
exports.Test = 'test2';

module.exports = 'test';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really something that should be allowed? Breaks in node

2 changes: 2 additions & 0 deletions demo/public/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import test, { Test } from './cjs';
import { h, render } from 'preact';
import { Loc, Router } from './loc.js';
import lazy from './lazy.js';
Expand All @@ -14,6 +15,7 @@ const Files = lazy(() => import('./pages/files/index.js'));
const Environment = lazy(async () => (await import('./pages/environment/index.js')).Environment);

export function App() {
console.log(test, Test);
return (
<Loc>
<div class="app">
Expand Down
5 changes: 0 additions & 5 deletions src/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import aliasesPlugin from './plugins/aliases-plugin.js';
import processGlobalPlugin from './plugins/process-global-plugin.js';
import urlPlugin from './plugins/url-plugin.js';
import resolveExtensionsPlugin from './plugins/resolve-extensions-plugin.js';
import fastCjsPlugin from './plugins/fast-cjs-plugin.js';
import bundlePlugin from './plugins/bundle-plugin.js';
import jsonPlugin from './plugins/json-plugin.js';

Expand Down Expand Up @@ -97,10 +96,6 @@ export async function bundleProd({
typescript: true,
index: true
}),
fastCjsPlugin({
// Only transpile CommonJS in node_modules and explicit .cjs files:
include: /(?:^[\b]npm\/|[/\\]node_modules[/\\]|\.cjs$)/
}),
json(),
npmPlugin({ external: false }),
minifyCssPlugin({ sourcemap }),
Expand Down
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ prog.parse(process.argv);

function run(p) {
p.catch(err => {
const text = (process.env.DEBUG ? err.stack : err.message) || err + '';
const text = err.stack;
process.stderr.write(`${kl.red(text)}\n`);
process.exit(p.code || 1);
});
Expand Down
Loading