Skip to content

Commit 7f11792

Browse files
author
Martynas Žilinskas
committed
v0.1.0-alpha.11
1 parent 298da73 commit 7f11792

File tree

4 files changed

+34
-12
lines changed

4 files changed

+34
-12
lines changed

package-lock.json

Lines changed: 22 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simplrjs/webpack",
3-
"version": "0.1.0-alpha.10",
3+
"version": "0.1.0-alpha.11",
44
"description": "Tailored webpack for SPA.",
55
"publishConfig": {
66
"access": "public"

src/contracts.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@ export interface SimplrWebpackOptions {
2929
* Example: `./dist` + `./fonts` = `./dist/fonts`
3030
*/
3131
fontsDirectoryOutput?: string;
32+
/**
33+
* For websites "/" is enough. For electron-renderer "./".
34+
*
35+
* Default "/"
36+
*/
37+
publicPath?: string;
3238
target?: SimplrWebpackTarget;
3339
}

src/webpack-config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export function generateWebpackConfig(opts: SimplrWebpackOptions): Configuration
2323
staticContentDirectoryOutput: opts.staticContentDirectoryOutput || "./static",
2424
fontsDirectoryOutput: opts.fontsDirectoryOutput || "./fonts",
2525
emitHtml: opts.emitHtml != null ? opts.emitHtml : true,
26-
target: opts.target || "web"
26+
target: opts.target || "web",
27+
publicPath: opts.publicPath || "/"
2728
};
2829
const fullOutputDirectoryLocation = path.resolve(options.projectDirectory, options.outputDirectory);
2930
const fullTsconfigLocation = path.resolve(options.projectDirectory, Helpers.TS_CONFIG_NAME);
@@ -52,7 +53,7 @@ export function generateWebpackConfig(opts: SimplrWebpackOptions): Configuration
5253
filename: "[name].bundle.js",
5354
chunkFilename: "[name].bundle.js",
5455
path: fullOutputDirectoryLocation,
55-
publicPath: "/"
56+
publicPath: opts.publicPath
5657
},
5758
resolve: {
5859
extensions: [".ts", ".tsx", ".js", ".json", ".scss", ".css"],
@@ -105,7 +106,8 @@ export function generateWebpackConfig(opts: SimplrWebpackOptions): Configuration
105106
{
106107
test: /\.(woff|woff2|eot|ttf|otf)$/,
107108
options: {
108-
name: `./${options.fontsDirectoryOutput}/[name].[ext]`
109+
name: `./${options.fontsDirectoryOutput}/[name].[ext]`,
110+
publicPath: opts.publicPath
109111
},
110112
loader: "file-loader"
111113
}

0 commit comments

Comments
 (0)