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
2 changes: 1 addition & 1 deletion react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dev": "webpack --config ./webpack.dev.js",
"dev-server": "webpack serve --config ./webpack.dev.js --no-open",
"dev-server:https": "cross-env HTTPS=true webpack serve --config ./webpack.dev.js --no-open",
"clean": "rimraf dist"
"clean": "rimraf build dist"
},
"dependencies": {
"@nvidia/cloudxr": "dev",
Expand Down
19 changes: 6 additions & 13 deletions react/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const { nvidiaCloudxrWebpackAlias } = require('../webpack-nvidia-cloudxr-alias.cjs');

// WebXR input profile assets are used by default when @webxr-input-profiles/assets is installed.
// Set USE_LOCAL_WEBXR_ASSETS=0 to skip bundling local assets (build needs internet at runtime to load assets).
const useLocalWebxrAssets = process.env.USE_LOCAL_WEBXR_ASSETS !== '0';
let webxrAssetsPackagePath = null;
let WEBXR_ASSETS_VERSION = '';
Expand All @@ -40,23 +39,21 @@ if (useLocalWebxrAssets) {
module.exports = {
entry: './src/index.tsx',

// Enable webpack 5 persistent filesystem caching for faster incremental builds
cache: {
type: 'filesystem',
name: 'react',
buildDependencies: {
config: [__filename],
},
},

// Module rules define how different file types are processed
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: 'ts-loader',
options: {
// Only transpile, don't type-check (faster builds)
transpileOnly: true,
},
},
Expand All @@ -69,35 +66,31 @@ module.exports = {
],
},

// Resolve configuration for module resolution
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
// @helpers can be used instead of relative paths to the helpers directory
'@helpers': path.resolve(__dirname, './helpers'),
// If OVERRIDE_CLOUDXR_FILENAME is set (testing only), @nvidia/cloudxr resolves to that bundle
// basename next to package main—not for production. See ../webpack-nvidia-cloudxr-alias.cjs.
...nvidiaCloudxrWebpackAlias(__dirname),
},
},

// Output configuration for bundled files
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, './build'),
path: path.resolve(__dirname, 'build'),
},

// Webpack plugins that extend webpack's functionality
plugins: [
// Generates HTML file and automatically injects bundled JavaScript
new HtmlWebpackPlugin({
template: './src/index.html',
favicon: './favicon.ico',
}),

// Inject environment variables
new webpack.DefinePlugin({
'process.env.WEBXR_ASSETS_VERSION': JSON.stringify(WEBXR_ASSETS_VERSION),
}),

// Copies WebXR input profile assets when available; always copies public and favicon
new CopyWebpackPlugin({
patterns: [
...(webxrAssetsPackagePath
Expand Down
2 changes: 1 addition & 1 deletion react/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = merge(common, {
...(useHttps && { server: 'https' }),
static: [
{
directory: path.join(__dirname, './build'),
directory: path.join(__dirname, 'build'),
},
{
directory: path.join(__dirname, './public'),
Expand Down
14 changes: 6 additions & 8 deletions simple/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { nvidiaCloudxrWebpackAlias } = require('../webpack-nvidia-cloudxr-alias.cjs');

module.exports = {
entry: './src/main.ts',

// Enable webpack 5 persistent filesystem caching for faster incremental builds
cache: {
type: 'filesystem',
name: 'simple',
buildDependencies: {
config: [__filename],
},
},

// Module rules define how different file types are processed
module: {
rules: [
{
Expand All @@ -40,24 +40,22 @@ module.exports = {
],
},

// Resolve configuration for module resolution
resolve: {
extensions: ['.ts', '.js'],
alias: {
// @helpers can be used instead of relative paths to the helpers directory
'@helpers': path.resolve(__dirname, './helpers'),
// If OVERRIDE_CLOUDXR_FILENAME is set (testing only), @nvidia/cloudxr resolves to that bundle
// basename next to package main—not for production. See ../webpack-nvidia-cloudxr-alias.cjs.
...nvidiaCloudxrWebpackAlias(__dirname),
},
},

// Output configuration for bundled files
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, './build'),
path: path.resolve(__dirname, 'build'),
},

// Webpack plugins that extend webpack's functionality
plugins: [
// Generates HTML file and automatically injects bundled JavaScript
new HtmlWebpackPlugin({
template: './index.html',
favicon: './favicon.ico',
Expand Down
2 changes: 1 addition & 1 deletion simple/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = merge(common, {
// Enable HTTPS with self-signed certificate when HTTPS=true
...(useHttps && { server: 'https' }),
static: {
directory: path.join(__dirname, './build'),
directory: path.join(__dirname, 'build'),
watch: true,
},
watchFiles: {
Expand Down
Loading