@plaudit/webpack-extensions 2.0.0-beta.9 → 2.0.0

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.
@@ -6,11 +6,11 @@ const node_fs_1 = __importDefault(require("node:fs"));
6
6
  const node_path_1 = __importDefault(require("node:path"));
7
7
  const AdditionalDependencyInjectorPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/AdditionalDependencyInjectorPlugin"));
8
8
  const BlockJSONStyleRemappingPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/BlockJSONStyleRemappingPlugin"));
9
+ const browser_sync_webpack_plugin_1 = __importDefault(require("browser-sync-webpack-plugin"));
9
10
  const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
10
11
  const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
11
12
  const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-empty-scripts"));
12
13
  const cssnano_1 = __importDefault(require("cssnano"));
13
- const browser_sync_webpack_plugin_1 = __importDefault(require("browser-sync-webpack-plugin"));
14
14
  function joinPossiblyAbsolutePaths(...paths) {
15
15
  return paths.reduce((res, p) => !res || node_path_1.default.isAbsolute(p) ? p : node_path_1.default.join(res, p), '') || '.';
16
16
  }
@@ -155,11 +155,17 @@ module.exports = function (config, webpackConfig = require("@wordpress/scripts/c
155
155
  plugins.push(new BlockJSONStyleRemappingPlugin_1.default());
156
156
  }
157
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
- }));
158
+ if (first) {
159
+ first = false;
160
+ if (process.argv.includes('--browser-sync')) {
161
+ plugins.push(new browser_sync_webpack_plugin_1.default({
162
+ host: 'localhost',
163
+ port: 3000,
164
+ https: true,
165
+ proxy: 'https://localhost:8443'
166
+ }));
167
+ }
168
+ }
163
169
  let entry;
164
170
  if (srcIsDirectory) {
165
171
  entry = node_fs_1.default.readdirSync(srcRoot, 'utf8')
@@ -231,33 +237,9 @@ module.exports = function (config, webpackConfig = require("@wordpress/scripts/c
231
237
  path: joinPossiblyAbsolutePaths(process.cwd(), node_path_1.default.dirname(dest))
232
238
  };
233
239
  }
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
- }
257
240
  return {
258
241
  ...webpackConfig,
259
242
  devtool: 'source-map',
260
- // devServer,
261
243
  output: {
262
244
  ...webpackConfig.output,
263
245
  ...output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.0",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",