diff --git a/bin/packages/build-worker.js b/bin/packages/build-worker.js index 3f1512ef0feb78..8033976c045317 100644 --- a/bin/packages/build-worker.js +++ b/bin/packages/build-worker.js @@ -13,6 +13,8 @@ const postcss = require( 'postcss' ); */ const getBabelConfig = require( './get-babel-config' ); +const isDev = process.env.NODE_ENV === 'development'; + /** * Path to packages directory. * @@ -27,10 +29,12 @@ const PACKAGES_DIR = path * * @type {Object} */ -const JS_ENVIRONMENTS = { - main: 'build', - module: 'build-module', -}; +const JS_ENVIRONMENTS = isDev + ? { module: 'build-module' } + : { + main: 'build', + module: 'build-module', + }; /** * Promisified fs.readFile. diff --git a/package.json b/package.json index ca8ebb89876a60..6e214c0b738bbe 100644 --- a/package.json +++ b/package.json @@ -274,8 +274,8 @@ "build:plugin-zip": "bash ./bin/build-plugin-zip.sh", "clean:package-types": "tsc --build --clean && rimraf \"./packages/*/build-types\"", "clean:packages": "rimraf \"./packages/*/@(build|build-module|build-style)\"", - "dev": "npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"", - "dev:packages": "concurrently \"node ./bin/packages/watch.js\" \"tsc --build --watch\"", + "dev": "cross-env NODE_ENV=development npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"", + "dev:packages": "cross-env NODE_ENV=development concurrently \"node ./bin/packages/watch.js\" \"tsc --build --watch\"", "distclean": "git clean --force -d -X", "docs:api-ref": "node ./bin/api-docs/update-api-docs.js", "docs:blocks": "node ./bin/api-docs/gen-block-lib-list.js",