@plaudit/webpack-extensions 2.0.0-beta.8 → 2.0.0-beta.9
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.
|
@@ -10,6 +10,7 @@ const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
|
|
|
10
10
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
11
11
|
const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-empty-scripts"));
|
|
12
12
|
const cssnano_1 = __importDefault(require("cssnano"));
|
|
13
|
+
const browser_sync_webpack_plugin_1 = __importDefault(require("browser-sync-webpack-plugin"));
|
|
13
14
|
function joinPossiblyAbsolutePaths(...paths) {
|
|
14
15
|
return paths.reduce((res, p) => !res || node_path_1.default.isAbsolute(p) ? p : node_path_1.default.join(res, p), '') || '.';
|
|
15
16
|
}
|
|
@@ -134,6 +135,7 @@ module.exports = function (config, webpackConfig = require("@wordpress/scripts/c
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
138
|
+
let first = true;
|
|
137
139
|
const sources = Array.isArray(config.src) ? config.src.map(s => [s, s]) : Object.entries(config.src);
|
|
138
140
|
return sources.map(([src, dest]) => {
|
|
139
141
|
const srcRoots = src.split(',');
|
|
@@ -153,6 +155,11 @@ module.exports = function (config, webpackConfig = require("@wordpress/scripts/c
|
|
|
153
155
|
plugins.push(new BlockJSONStyleRemappingPlugin_1.default());
|
|
154
156
|
}
|
|
155
157
|
plugins.push(new AdditionalDependencyInjectorPlugin_1.default());
|
|
158
|
+
plugins.push(new browser_sync_webpack_plugin_1.default({
|
|
159
|
+
host: 'localhost',
|
|
160
|
+
port: 3000,
|
|
161
|
+
https: true
|
|
162
|
+
}));
|
|
156
163
|
let entry;
|
|
157
164
|
if (srcIsDirectory) {
|
|
158
165
|
entry = node_fs_1.default.readdirSync(srcRoot, 'utf8')
|
|
@@ -224,9 +231,33 @@ module.exports = function (config, webpackConfig = require("@wordpress/scripts/c
|
|
|
224
231
|
path: joinPossiblyAbsolutePaths(process.cwd(), node_path_1.default.dirname(dest))
|
|
225
232
|
};
|
|
226
233
|
}
|
|
234
|
+
let devServer = undefined;
|
|
235
|
+
if (first) {
|
|
236
|
+
first = false;
|
|
237
|
+
devServer = {
|
|
238
|
+
devMiddleware: {
|
|
239
|
+
writeToDisk: true,
|
|
240
|
+
},
|
|
241
|
+
static: {
|
|
242
|
+
directory: '/'
|
|
243
|
+
},
|
|
244
|
+
proxy: {
|
|
245
|
+
'/': {
|
|
246
|
+
target: 'https://localhost:8443',
|
|
247
|
+
changeOrigin: false,
|
|
248
|
+
secure: false
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
allowedHosts: 'all',
|
|
252
|
+
host: 'localhost',
|
|
253
|
+
port: 3000,
|
|
254
|
+
server: 'https'
|
|
255
|
+
};
|
|
256
|
+
}
|
|
227
257
|
return {
|
|
228
258
|
...webpackConfig,
|
|
229
259
|
devtool: 'source-map',
|
|
260
|
+
// devServer,
|
|
230
261
|
output: {
|
|
231
262
|
...webpackConfig.output,
|
|
232
263
|
...output
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.9",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepublishOnly": "rm -rf build && mkdir build && tsc",
|
|
6
6
|
"build": "tsc",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"./wordpress-scripts-wrapper": "./build/wordpress-scripts-wrapper.js"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
+
"@types/browser-sync-webpack-plugin": "^2.2.2",
|
|
16
17
|
"@types/node": "^20.2.5",
|
|
18
|
+
"@types/tapable": "^2.2.3",
|
|
17
19
|
"@types/webpack": "^5.28.1",
|
|
18
20
|
"@types/webpack-sources": "^3.2.0",
|
|
19
21
|
"postcss-load-config": "^4.0.1",
|
|
@@ -28,6 +30,8 @@
|
|
|
28
30
|
"@plaudit/postcss-variables": "^1.0.0",
|
|
29
31
|
"@wordpress/scripts": "^26.6.0",
|
|
30
32
|
"autoprefixer": "^10.4.14",
|
|
33
|
+
"browser-sync": "^2.29.3",
|
|
34
|
+
"browser-sync-webpack-plugin": "^2.3.0",
|
|
31
35
|
"clean-webpack-plugin": "^4.0.0",
|
|
32
36
|
"copy-webpack-plugin": "^11.0.0",
|
|
33
37
|
"cssnano": "^6.0.1",
|