Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion packages/repl/src/lib/workers/bundler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ async function get_bundle(
glsl,
loop_protect,
replace({
'process.env.NODE_ENV': JSON.stringify('production')
'process.env.NODE_ENV': JSON.stringify('production'),
'import.meta.env.MODE': JSON.stringify('development')
}),
{
name: 'css',
Expand Down
7 changes: 5 additions & 2 deletions packages/repl/src/lib/workers/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ export function resolve_subpath(pkg: Package, subpath: string): string {
}

export function normalize_path(pkg: Package, path: string, importee: string, importer: string) {
for (const suffix of ['', '.js', '.mjs', '.cjs', '/index.js', '/index.mjs', '/index.cjs']) {
let with_suffix = path + suffix;
const suffixes = path.endsWith('/')
? ['index.js', 'index.mjs', 'index.cjs']
: ['', '.js', '.mjs', '.cjs', '/index.js', '/index.mjs', '/index.cjs'];
for (const suffix of suffixes) {
let with_suffix = (path + suffix).replace(/\/+/g, '/');

if (pkg.meta.browser) {
with_suffix = pkg.meta.browser[`./${with_suffix}`]?.replace('./', '') ?? with_suffix;
Expand Down