@caweb/webpack 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/webpack.config.js +19 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caweb/webpack",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "CAWebPublishing Webpack Configuration",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"webpack": "webpack",
|
|
12
|
+
"preserve": "cd plugins/html && npm i",
|
|
12
13
|
"serve": "set NODE_OPTIONS='--no-selectors' && webpack serve --config ./webpack.config.js ./plugins/html/entry/oceanside.js --merge",
|
|
13
14
|
"build": "npm run build:html",
|
|
14
15
|
"build:html": "cd ./plugins/html/ && npm run build",
|
package/webpack.config.js
CHANGED
|
@@ -118,6 +118,24 @@ let webpackConfig = {
|
|
|
118
118
|
if( 'serve' === webpackCommand ){
|
|
119
119
|
const appPath = process.cwd();
|
|
120
120
|
const samplePath = path.join( appPath, 'sample');
|
|
121
|
+
const templates = ['blank', 'default'];
|
|
122
|
+
|
|
123
|
+
let template;
|
|
124
|
+
|
|
125
|
+
// Allow for template to be selected via NODE_OPTIOS env variable
|
|
126
|
+
if( process.env.NODE_OPTIONS ){
|
|
127
|
+
let opts = process.env.NODE_OPTIONS.split(' ').filter(e=>e).map(o=>o.replaceAll("'", ''))
|
|
128
|
+
if( opts.includes('--template') ){
|
|
129
|
+
template = opts[opts.indexOf('--template') + 1]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Arguments passed to the process supersede env vars
|
|
134
|
+
if( process.argv.includes('--template') ){
|
|
135
|
+
template = process.argv[process.argv.indexOf('--template') + 1];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
template = templates.includes(template) ? template : 'default';
|
|
121
139
|
|
|
122
140
|
// Dev Server is added
|
|
123
141
|
webpackConfig.devServer = {
|
|
@@ -176,7 +194,7 @@ if( 'serve' === webpackCommand ){
|
|
|
176
194
|
let pageTemplate = {
|
|
177
195
|
title : path.basename(appPath),
|
|
178
196
|
filename: path.join( appPath, 'public', 'index.html'),
|
|
179
|
-
template: path.join( appPath, 'node_modules', '@caweb', 'html-webpack-plugin', 'sample',
|
|
197
|
+
template: path.join( appPath, 'node_modules', '@caweb', 'html-webpack-plugin', 'sample', `${template}.html`),
|
|
180
198
|
favicon: fs.existsSync(path.join(samplePath, 'favicon.ico')) ? path.join(samplePath, 'favicon.ico') : false,
|
|
181
199
|
minify: false,
|
|
182
200
|
scriptLoading: 'blocking',
|