@@ -31,14 +31,15 @@ const toPath = path => {
3131class ScratchWebpackConfigBuilder {
3232 /**
3333 * @param {object } options Options for the webpack configuration.
34- * @param {string|URL } options.rootPath The absolute path to the project root.
34+ * @param {string|URL } [ options.rootPath] The absolute path to the project root.
3535 * @param {string|URL } [options.distPath] The absolute path to build output. Defaults to `dist` under `rootPath`.
36+ * @param {string|URL } [options.publicPath] The public location where the output assets will be located. Defaults to `/`.
3637 * @param {boolean } [options.enableReact] Whether to enable React and JSX support.
3738 * @param {string } [options.libraryName] The name of the library to build. Shorthand for `output.library.name`.
3839 * @param {string|URL } [options.srcPath] The absolute path to the source files. Defaults to `src` under `rootPath`.
3940 * @param {boolean } [options.shouldSplitChunks] Whether to enable spliting code to chunks.
4041 */
41- constructor ( { distPath, enableReact, enableTs, libraryName, rootPath, srcPath, shouldSplitChunks } ) {
42+ constructor ( { distPath, enableReact, enableTs, libraryName, rootPath, srcPath, publicPath = '/' , shouldSplitChunks } ) {
4243 const isProduction = process . env . NODE_ENV === 'production' ;
4344 const mode = isProduction ? 'production' : 'development' ;
4445
@@ -83,6 +84,8 @@ class ScratchWebpackConfigBuilder {
8384 assetModuleFilename : DEFAULT_ASSET_FILENAME ,
8485 chunkFilename : DEFAULT_CHUNK_FILENAME ,
8586 path : this . _distPath ,
87+ // See https://github.com/scratchfoundation/scratch-editor/pull/25/files/9bc537f9bce35ee327b74bd6715d6c5140f73937#r1763073684
88+ publicPath,
8689 library : {
8790 name : libraryName ,
8891 type : 'umd2'
0 commit comments