Skip to content

Commit

Permalink
fix(build): Bazel should produce prod build.
Browse files Browse the repository at this point in the history
The dev build of bazel creates a 'import()' inside `.cjs` files.
  • Loading branch information
mhevery committed Jan 16, 2022
1 parent 4ef6a85 commit 0514dc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scripts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ nodejs_binary(
entry_point = ":index.js",
templated_args = [
"--build",
"--dev",
# Adding dev seems to break the output in a way where a CJS output still has `import()`
# "--dev",
"--tsc",
"--api",
# Dissable these flags, as we don't need them for now.
Expand Down
5 changes: 4 additions & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export async function build(config: BuildConfig) {
await setDevVersion(config);
}

console.log(`🌎 Qwik v${config.distVersion}`);
console.log(
`🌎 Qwik v${config.distVersion}`,
`[node: ${process.version}, platform: ${process.platform}, arch: ${process.arch}]`
);

if (config.tsc) {
tsc(config);
Expand Down
4 changes: 4 additions & 0 deletions scripts/package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export async function generatePackageJson(config: BuildConfig) {
import: './core.mjs',
require: './core.cjs',
},
'./core.cjs': './core.cjs',
'./core.mjs': './core.mjs',
'./jsx-runtime': {
import: './jsx-runtime.mjs',
require: './jsx-runtime.cjs',
Expand All @@ -36,6 +38,7 @@ export async function generatePackageJson(config: BuildConfig) {
import: './optimizer.mjs',
require: './optimizer.cjs',
},
'./server/index.cjs': './server/index.cjs',
'./server': {
import: './server/index.mjs',
require: './server/index.cjs',
Expand All @@ -44,6 +47,7 @@ export async function generatePackageJson(config: BuildConfig) {
import: './testing/index.mjs',
require: './testing/index.cjs',
},
'./qwikloader.js': './qwikloader.js',
'./package.json': './package.json',
},
files: Array.from(new Set(rootPkg.files)).sort((a, b) => {
Expand Down

0 comments on commit 0514dc8

Please sign in to comment.