From c6854773aa1df04bfc9eb465a8d7da508e58cd61 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Thu, 11 Jun 2020 13:54:31 +0200 Subject: [PATCH] Alias for browser bundle via webpack, not browser field --- packages/wpcom.js/package.json | 10 +++++----- .../{webpack.config.js => webpack.config.browser.cjs} | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) rename packages/wpcom.js/{webpack.config.js => webpack.config.browser.cjs} (75%) diff --git a/packages/wpcom.js/package.json b/packages/wpcom.js/package.json index fde54a0f2c00d..6f0c71a85ea72 100644 --- a/packages/wpcom.js/package.json +++ b/packages/wpcom.js/package.json @@ -7,6 +7,10 @@ "import": "dist/esm/index.js", "require": "dist/cjs/index.js" }, + "browser": { + "./dist/cjs/lib/util/fs.js": "./dist/cjs/lib/util/fs-browser.js", + "./dist/esm/lib/util/fs.js": "./dist/esm/lib/util/fs-browser.js" + }, "type": "module", "author": "Automattic, Inc.", "private": true, @@ -15,7 +19,7 @@ "prepublish": "check-npm-client && yarn run clean", "prepare": "check-npm-client && run-s build:modules build:bundle", "build:modules": "check-npm-client && transpile", - "build:bundle": "check-npm-client && webpack --display errors-only" + "build:bundle": "check-npm-client && webpack --display errors-only --config webpack.config.browser.cjs" }, "keywords": [ "wordpress", @@ -36,10 +40,6 @@ "History.md", "README.md" ], - "browser": { - "./dist/cjs/lib/util/fs.js": "./dist/cjs/lib/util/fs-browser.js", - "./dist/esm/lib/util/fs.js": "./dist/esm/lib/util/fs-browser.js" - }, "dependencies": { "@babel/runtime": "^7.8.3", "debug": "^4.1.1", diff --git a/packages/wpcom.js/webpack.config.js b/packages/wpcom.js/webpack.config.browser.cjs similarity index 75% rename from packages/wpcom.js/webpack.config.js rename to packages/wpcom.js/webpack.config.browser.cjs index a1956121d6773..3a9554aaa21fe 100644 --- a/packages/wpcom.js/webpack.config.js +++ b/packages/wpcom.js/webpack.config.browser.cjs @@ -1,3 +1,5 @@ +// This is to build a browser version +const path = require( 'path' ); module.exports = { mode: 'production', entry: __dirname + '/dist/esm/index.js',