Fix build issues for production builds (https://github.com/woocommerce/woocommerce-blocks/pull/2042)
* add payment-methods-demo config to sideEffects and install @wordpress/icons and @wordpress/primitives to be used directly. * configure dependency extraction to ignore imports we want to use directly * fix style issues for production builds It looks like when a style is imported on the entrypoint of a component (or in a file with just exports), it get’s treeshaken from the final build _regardless of exception rules_. * fix style imports from wordpress components * fix loading skeleton showing on production builds * fix block skeleton showing on production builds for cart * import side effectful code * add treatment for `@wordpress/warning` too * fix typo * exclude `settings/block` from sideEffects * rollback `wordpress-components` update and keep sideEffects fixes * remove unnecessary handle handling Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
This commit is contained in:
parent
676e10b805
commit
1648e651b4
|
@ -8,6 +8,7 @@ import { useExpressPaymentMethods } from '@woocommerce/base-hooks';
|
|||
* Internal dependencies
|
||||
*/
|
||||
import ExpressPaymentMethods from './express-payment-methods';
|
||||
import './style.scss';
|
||||
|
||||
const ExpressCheckoutContainer = ( { children } ) => {
|
||||
return (
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import './style.scss';
|
||||
|
||||
export { default as PaymentMethods } from './payment-methods';
|
||||
export { default as ExpressPaymentMethods } from './express-payment-methods';
|
||||
export { default as ExpressCheckoutFormControl } from './express-checkout';
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import './style.scss';
|
||||
|
||||
export { default as Sidebar } from './sidebar';
|
||||
export { default as Main } from './main';
|
||||
export { default as SidebarLayout } from './sidebar-layout';
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
import classNames from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import './style.scss';
|
||||
|
||||
const SidebarLayout = ( { children, className } ) => {
|
||||
return (
|
||||
<div className={ classNames( 'wc-block-sidebar-layout', className ) }>
|
||||
|
|
|
@ -152,10 +152,10 @@ table.wc-block-cart-items {
|
|||
min-height: 460px;
|
||||
}
|
||||
}
|
||||
.wc-block-cart--skeleton {
|
||||
.wc-block-sidebar-layout.wc-block-cart--skeleton {
|
||||
display: none;
|
||||
}
|
||||
.is-loading + .wc-block-cart--skeleton {
|
||||
.is-loading + .wc-block-sidebar-layout.wc-block-cart--skeleton {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,10 +154,10 @@
|
|||
min-height: 460px;
|
||||
}
|
||||
}
|
||||
.wc-block-checkout--skeleton {
|
||||
.wc-block-sidebar-layout.wc-block-checkout--skeleton {
|
||||
display: none;
|
||||
}
|
||||
.is-loading + .wc-block-checkout--skeleton {
|
||||
.is-loading + .wc-block-sidebar-layout.wc-block-checkout--skeleton {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
export * from './store-api-nonce';
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import './store-api-nonce';
|
||||
|
||||
export * from './constants';
|
||||
export { ENDPOINTS } from './endpoints';
|
||||
|
|
|
@ -46,7 +46,7 @@ const setNonce = ( headers ) => {
|
|||
*
|
||||
* @return {*} The evaluated result of the remaining middleware chain.
|
||||
*/
|
||||
export const storeNonceMiddleware = ( options, next ) => {
|
||||
const storeNonceMiddleware = ( options, next ) => {
|
||||
if ( isStoreApiGetRequest( options ) ) {
|
||||
const existingHeaders = options.headers || {};
|
||||
options.headers = {
|
||||
|
|
|
@ -105,15 +105,15 @@ const stableMainEntry = {
|
|||
blocks: './assets/js/index.js',
|
||||
|
||||
// @wordpress/components styles
|
||||
'panel-style': './node_modules/@wordpress/components/src/panel/style.scss',
|
||||
'panel-style': './node_modules/wordpress-components/src/panel/style.scss',
|
||||
'custom-select-control-style':
|
||||
'./node_modules/@wordpress/components/src/custom-select-control/style.scss',
|
||||
'./node_modules/wordpress-components/src/custom-select-control/style.scss',
|
||||
'checkbox-control-style':
|
||||
'./node_modules/@wordpress/components/src/checkbox-control/style.scss',
|
||||
'./node_modules/wordpress-components/src/checkbox-control/style.scss',
|
||||
'spinner-style':
|
||||
'./node_modules/@wordpress/components/src/spinner/style.scss',
|
||||
'./node_modules/wordpress-components/src/spinner/style.scss',
|
||||
'snackbar-notice-style':
|
||||
'./node_modules/@wordpress/components/src/snackbar/style.scss',
|
||||
'./node_modules/wordpress-components/src/snackbar/style.scss',
|
||||
|
||||
// Blocks
|
||||
'handpicked-products': './assets/js/blocks/handpicked-products/index.js',
|
||||
|
|
|
@ -5293,7 +5293,6 @@
|
|||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/element/-/element-2.10.0.tgz",
|
||||
"integrity": "sha512-CedhhFfcubM/lsluY7JPC49VG0/Ee0chOBJ1vyDEvIJmQk0bM3sLfgt5qVK773yivVOqD9blQMO+JihnaMXF8w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"@wordpress/escape-html": "^1.6.0",
|
||||
|
@ -5366,7 +5365,6 @@
|
|||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.8.0.tgz",
|
||||
"integrity": "sha512-SXheA3E2aA/w5/cubrIho3fCLY5Jb7zdpg7NGS3DFXYEe5VICMdmgNxeYFoeyNSw2IkNmphJhsZXzVIMf92dYQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"gettext-parser": "^1.3.1",
|
||||
|
@ -5406,7 +5404,6 @@
|
|||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-1.7.0.tgz",
|
||||
"integrity": "sha512-fRHTAivQlWOQVn8wu8NHM8D5sacSvY6upJ+MgWSu1Q7pqy51zaCPE2T9lhym3GC1QzABus6VjDctR8jwfNfd/g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4"
|
||||
}
|
||||
|
@ -29487,39 +29484,28 @@
|
|||
"@wordpress/is-shallow-equal": "^1.8.0",
|
||||
"lodash": "^4.17.15",
|
||||
"mousetrap": "^1.6.2"
|
||||
}
|
||||
},
|
||||
"@wordpress/element": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/element/-/element-2.11.0.tgz",
|
||||
"integrity": "sha512-56ZO8a+E7QEsYwiqS+3BQPSHrCPsOAIEz5smXzntb2f6BjvOKeA64pup40mdn1pNGexe06LBA8cjoZVdLBHB1w==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"@wordpress/escape-html": "^1.7.0",
|
||||
"lodash": "^4.17.15",
|
||||
"react": "^16.9.0",
|
||||
"react-dom": "^16.9.0"
|
||||
}
|
||||
},
|
||||
"@wordpress/i18n": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.9.0.tgz",
|
||||
"integrity": "sha512-ACpLPvdzAosAPqSLUaYQSX7fB5yAV5dFy8Y37FWLsZrv4NhUQ+rfDLdrXrCWm19LEZ5nTFfZUT0TIbYKekqIug==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"gettext-parser": "^1.3.1",
|
||||
"lodash": "^4.17.15",
|
||||
"memize": "^1.0.5",
|
||||
"sprintf-js": "^1.1.1",
|
||||
"tannin": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"@wordpress/is-shallow-equal": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-1.8.0.tgz",
|
||||
"integrity": "sha512-OV3qJqP9LhjuOzt85TsyBwv+//CvC8Byf/81D3NmjPKlstLaD/bBCC5nBhH6dKAv4bShYtQ2Hmut+V4dZnOM1A==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wordpress/element": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/element/-/element-2.11.0.tgz",
|
||||
"integrity": "sha512-56ZO8a+E7QEsYwiqS+3BQPSHrCPsOAIEz5smXzntb2f6BjvOKeA64pup40mdn1pNGexe06LBA8cjoZVdLBHB1w==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"@wordpress/escape-html": "^1.7.0",
|
||||
"lodash": "^4.17.15",
|
||||
"react": "^16.9.0",
|
||||
"react-dom": "^16.9.0"
|
||||
}
|
||||
},
|
||||
"@wordpress/is-shallow-equal": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-1.8.0.tgz",
|
||||
"integrity": "sha512-OV3qJqP9LhjuOzt85TsyBwv+//CvC8Byf/81D3NmjPKlstLaD/bBCC5nBhH6dKAv4bShYtQ2Hmut+V4dZnOM1A==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@wordpress/keycodes": {
|
||||
|
@ -29530,6 +29516,21 @@
|
|||
"@babel/runtime": "^7.8.3",
|
||||
"@wordpress/i18n": "^3.9.0",
|
||||
"lodash": "^4.17.15"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wordpress/i18n": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.9.0.tgz",
|
||||
"integrity": "sha512-ACpLPvdzAosAPqSLUaYQSX7fB5yAV5dFy8Y37FWLsZrv4NhUQ+rfDLdrXrCWm19LEZ5nTFfZUT0TIbYKekqIug==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"gettext-parser": "^1.3.1",
|
||||
"lodash": "^4.17.15",
|
||||
"memize": "^1.0.5",
|
||||
"sprintf-js": "^1.1.1",
|
||||
"tannin": "^1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"downshift": {
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
"*.css",
|
||||
"*.scss",
|
||||
"./assets/js/atomic/blocks/product/**",
|
||||
"./assets/js/filters/**"
|
||||
"./assets/js/filters/**",
|
||||
"./assets/js/payment-methods-demo/**",
|
||||
"./assets/js/settings/blocks/**"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Loading…
Reference in New Issue