Skip to content

Commit e77f8b3

Browse files
author
Martynas Žilinskas
committed
v0.1.0-alpha.9
1 parent 6394d79 commit e77f8b3

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
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.8",
3+
"version": "0.1.0-alpha.9",
44
"description": "Tailored webpack for SPA.",
55
"publishConfig": {
66
"access": "public"

src/contracts.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
import { Options } from "html-webpack-template";
22

3+
// prettier-ignore
4+
export type SimplrWebpackTarget =
5+
| "web"
6+
| "node"
7+
| "electron-renderer";
8+
// | "webworker"
9+
// | "async-node"
10+
// | "node-webkit"
11+
// | "atom"
12+
// | "electron-main";
13+
314
export interface SimplrWebpackOptions {
415
devServerPort?: number;
516
emitHtml?: boolean;
@@ -8,5 +19,10 @@ export interface SimplrWebpackOptions {
819
entryFile?: string;
920
outputDirectory?: string;
1021
staticContentDirectory?: string;
11-
target?: "web" | "node";
22+
/**
23+
* Full path is: {outputDirectory} + {staticContentDirectoryOutput}
24+
* Example: `./dist` + `./static` = `./dist/static`
25+
*/
26+
staticContentDirectoryOutput?: string;
27+
target?: SimplrWebpackTarget;
1228
}

src/webpack-config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export function generateWebpackConfig(opts: SimplrWebpackOptions): Configuration
4343
devServerPort: opts.devServerPort || 3000,
4444
entryFile: opts.entryFile || "./src/index.ts",
4545
outputDirectory: opts.outputDirectory || "./wwwroot",
46-
staticContentDirectory: opts.outputDirectory || "./src/static",
46+
staticContentDirectory: opts.staticContentDirectory || "./src/static",
47+
staticContentDirectoryOutput: opts.staticContentDirectoryOutput || "./static",
4748
emitHtml: opts.emitHtml != null ? opts.emitHtml : true,
4849
target: opts.target || "web"
4950
};
@@ -142,7 +143,8 @@ export function generateWebpackConfig(opts: SimplrWebpackOptions): Configuration
142143
}),
143144
new CopyWebpackPlugin([
144145
{
145-
from: options.staticContentDirectory
146+
from: options.staticContentDirectory,
147+
to: options.staticContentDirectoryOutput
146148
}
147149
])
148150
],

0 commit comments

Comments
 (0)