2020-07-07 09:05:06 +00:00
|
|
|
/* eslint-disable no-console */
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
const path = require( 'path' );
|
2020-07-22 12:05:56 +00:00
|
|
|
const RemoveFilesPlugin = require( './remove-files-webpack-plugin' );
|
2020-07-07 09:05:06 +00:00
|
|
|
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
|
|
|
|
const ProgressBarPlugin = require( 'progress-bar-webpack-plugin' );
|
|
|
|
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
|
|
|
|
const { NormalModuleReplacementPlugin } = require( 'webpack' );
|
|
|
|
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
|
|
|
|
const chalk = require( 'chalk' );
|
|
|
|
const { kebabCase } = require( 'lodash' );
|
|
|
|
const CreateFileWebpack = require( 'create-file-webpack' );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
const { getEntryConfig } = require( './webpack-entries' );
|
|
|
|
const {
|
|
|
|
NODE_ENV,
|
|
|
|
requestToExternal,
|
|
|
|
requestToHandle,
|
|
|
|
findModuleMatch,
|
|
|
|
} = require( './webpack-helpers' );
|
|
|
|
|
|
|
|
const dashIconReplacementModule = path.resolve(
|
|
|
|
__dirname,
|
|
|
|
'../assets/js/module_replacements/dashicon.js'
|
|
|
|
);
|
|
|
|
|
2020-07-17 14:55:55 +00:00
|
|
|
const getProgressBarPluginConfig = ( name, fileSuffix ) => {
|
|
|
|
const isLegacy = fileSuffix && fileSuffix === 'legacy';
|
|
|
|
const progressBarPrefix = isLegacy ? 'Legacy ' : '';
|
|
|
|
return {
|
|
|
|
format:
|
|
|
|
chalk.blue( `Building ${ progressBarPrefix }${ name }` ) +
|
|
|
|
' [:bar] ' +
|
|
|
|
chalk.green( ':percent' ) +
|
|
|
|
' :msg (:elapsed seconds)',
|
|
|
|
summary: false,
|
|
|
|
customSummary: ( time ) => {
|
|
|
|
console.log(
|
|
|
|
chalk.green.bold(
|
|
|
|
`${ progressBarPrefix }${ name } assets build completed (${ time })`
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-07-07 09:05:06 +00:00
|
|
|
const getCoreConfig = ( options = {} ) => {
|
2021-01-07 12:02:21 +00:00
|
|
|
const { alias, resolvePlugins = [] } = options;
|
|
|
|
const resolve = alias
|
|
|
|
? {
|
|
|
|
alias,
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
};
|
2020-07-07 09:05:06 +00:00
|
|
|
return {
|
|
|
|
entry: getEntryConfig( 'core', options.exclude || [] ),
|
|
|
|
output: {
|
|
|
|
filename: ( chunkData ) => {
|
|
|
|
return `${ kebabCase( chunkData.chunk.name ) }.js`;
|
|
|
|
},
|
|
|
|
path: path.resolve( __dirname, '../build/' ),
|
|
|
|
library: [ 'wc', '[name]' ],
|
|
|
|
libraryTarget: 'this',
|
|
|
|
// This fixes an issue with multiple webpack projects using chunking
|
|
|
|
// overwriting each other's chunk loader function.
|
|
|
|
// See https://webpack.js.org/configuration/output/#outputjsonpfunction
|
|
|
|
jsonpFunction: 'webpackWcBlocksJsonp',
|
|
|
|
},
|
2020-11-09 10:44:58 +00:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
automaticNameDelimiter: '--',
|
|
|
|
},
|
|
|
|
},
|
2020-07-07 09:05:06 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader?cacheDirectory',
|
|
|
|
options: {
|
|
|
|
presets: [ '@wordpress/babel-preset-default' ],
|
|
|
|
plugins: [
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-class-properties'
|
|
|
|
),
|
|
|
|
].filter( Boolean ),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-01-07 12:02:21 +00:00
|
|
|
{
|
|
|
|
test: /\.s[c|a]ss$/,
|
|
|
|
use: {
|
|
|
|
loader: 'ignore-loader',
|
|
|
|
},
|
|
|
|
},
|
2020-07-07 09:05:06 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
2020-07-17 14:55:55 +00:00
|
|
|
new ProgressBarPlugin(
|
|
|
|
getProgressBarPluginConfig( 'Core', options.fileSuffix )
|
|
|
|
),
|
2020-07-22 12:20:54 +00:00
|
|
|
new DependencyExtractionWebpackPlugin( {
|
|
|
|
injectPolyfill: true,
|
|
|
|
requestToExternal,
|
|
|
|
requestToHandle,
|
|
|
|
} ),
|
2020-07-07 09:05:06 +00:00
|
|
|
new CreateFileWebpack( {
|
|
|
|
path: './',
|
|
|
|
// file name
|
|
|
|
fileName: 'blocks.ini',
|
|
|
|
// content of the file
|
2020-09-07 17:31:10 +00:00
|
|
|
content: `woocommerce_blocks_phase = ${
|
|
|
|
process.env.WOOCOMMERCE_BLOCKS_PHASE || 3
|
|
|
|
}`,
|
2020-07-07 09:05:06 +00:00
|
|
|
} ),
|
|
|
|
],
|
2021-01-07 12:02:21 +00:00
|
|
|
resolve,
|
2020-07-07 09:05:06 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const getMainConfig = ( options = {} ) => {
|
|
|
|
let { fileSuffix } = options;
|
|
|
|
const { alias, resolvePlugins = [] } = options;
|
|
|
|
fileSuffix = fileSuffix ? `-${ fileSuffix }` : '';
|
|
|
|
const resolve = alias
|
|
|
|
? {
|
|
|
|
alias,
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
};
|
|
|
|
return {
|
|
|
|
entry: getEntryConfig( 'main', options.exclude || [] ),
|
|
|
|
output: {
|
|
|
|
devtoolNamespace: 'wc',
|
|
|
|
path: path.resolve( __dirname, '../build/' ),
|
|
|
|
filename: `[name]${ fileSuffix }.js`,
|
|
|
|
library: [ 'wc', 'blocks', '[name]' ],
|
|
|
|
libraryTarget: 'this',
|
|
|
|
// This fixes an issue with multiple webpack projects using chunking
|
|
|
|
// overwriting each other's chunk loader function.
|
|
|
|
// See https://webpack.js.org/configuration/output/#outputjsonpfunction
|
|
|
|
jsonpFunction: 'webpackWcBlocksJsonp',
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
minSize: 0,
|
2020-11-09 10:44:58 +00:00
|
|
|
automaticNameDelimiter: '--',
|
2020-07-07 09:05:06 +00:00
|
|
|
cacheGroups: {
|
|
|
|
commons: {
|
|
|
|
test: /[\\/]node_modules[\\/]/,
|
|
|
|
name: 'vendors',
|
|
|
|
chunks: 'all',
|
|
|
|
enforce: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader?cacheDirectory',
|
|
|
|
options: {
|
|
|
|
presets: [ '@wordpress/babel-preset-default' ],
|
|
|
|
plugins: [
|
|
|
|
NODE_ENV === 'production'
|
|
|
|
? require.resolve(
|
|
|
|
'babel-plugin-transform-react-remove-prop-types'
|
|
|
|
)
|
|
|
|
: false,
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-class-properties'
|
|
|
|
),
|
|
|
|
].filter( Boolean ),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-07-22 12:05:56 +00:00
|
|
|
test: /\.s[c|a]ss$/,
|
|
|
|
use: {
|
|
|
|
loader: 'ignore-loader',
|
|
|
|
},
|
2020-07-07 09:05:06 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
2020-07-17 14:55:55 +00:00
|
|
|
new ProgressBarPlugin(
|
|
|
|
getProgressBarPluginConfig( 'Main', options.fileSuffix )
|
|
|
|
),
|
2020-07-07 09:05:06 +00:00
|
|
|
new DependencyExtractionWebpackPlugin( {
|
|
|
|
injectPolyfill: true,
|
|
|
|
requestToExternal,
|
|
|
|
requestToHandle,
|
|
|
|
} ),
|
|
|
|
new NormalModuleReplacementPlugin(
|
|
|
|
/dashicon/,
|
|
|
|
( result ) => ( result.resource = dashIconReplacementModule )
|
|
|
|
),
|
|
|
|
],
|
|
|
|
resolve,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const getFrontConfig = ( options = {} ) => {
|
|
|
|
let { fileSuffix } = options;
|
|
|
|
const { alias, resolvePlugins = [] } = options;
|
|
|
|
fileSuffix = fileSuffix ? `-${ fileSuffix }` : '';
|
|
|
|
const resolve = alias
|
|
|
|
? {
|
|
|
|
alias,
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
};
|
|
|
|
return {
|
|
|
|
entry: getEntryConfig( 'frontend', options.exclude || [] ),
|
|
|
|
output: {
|
|
|
|
devtoolNamespace: 'wc',
|
|
|
|
path: path.resolve( __dirname, '../build/' ),
|
|
|
|
filename: `[name]-frontend${ fileSuffix }.js`,
|
|
|
|
// This fixes an issue with multiple webpack projects using chunking
|
|
|
|
// overwriting each other's chunk loader function.
|
|
|
|
// See https://webpack.js.org/configuration/output/#outputjsonpfunction
|
|
|
|
jsonpFunction: 'webpackWcBlocksJsonp',
|
|
|
|
},
|
2020-11-09 10:44:58 +00:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
automaticNameDelimiter: '--',
|
|
|
|
},
|
|
|
|
},
|
2020-07-07 09:05:06 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader?cacheDirectory',
|
|
|
|
options: {
|
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
modules: false,
|
|
|
|
targets: {
|
|
|
|
browsers: [
|
|
|
|
'extends @wordpress/browserslist-config',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-object-rest-spread'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-transform-react-jsx'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-async-generator-functions'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-transform-runtime'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-class-properties'
|
|
|
|
),
|
|
|
|
NODE_ENV === 'production'
|
|
|
|
? require.resolve(
|
|
|
|
'babel-plugin-transform-react-remove-prop-types'
|
|
|
|
)
|
|
|
|
: false,
|
|
|
|
].filter( Boolean ),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.s[c|a]ss$/,
|
|
|
|
use: {
|
|
|
|
loader: 'ignore-loader',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
2020-07-17 14:55:55 +00:00
|
|
|
new ProgressBarPlugin(
|
|
|
|
getProgressBarPluginConfig( 'Frontend', options.fileSuffix )
|
|
|
|
),
|
2020-07-07 09:05:06 +00:00
|
|
|
new DependencyExtractionWebpackPlugin( {
|
|
|
|
injectPolyfill: true,
|
|
|
|
requestToExternal,
|
|
|
|
requestToHandle,
|
|
|
|
} ),
|
|
|
|
new NormalModuleReplacementPlugin(
|
|
|
|
/dashicon/,
|
|
|
|
( result ) => ( result.resource = dashIconReplacementModule )
|
|
|
|
),
|
|
|
|
],
|
|
|
|
resolve,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const getPaymentsConfig = ( options = {} ) => {
|
|
|
|
const { alias, resolvePlugins = [] } = options;
|
|
|
|
const resolve = alias
|
|
|
|
? {
|
|
|
|
alias,
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
};
|
|
|
|
return {
|
|
|
|
entry: getEntryConfig( 'payments', options.exclude || [] ),
|
|
|
|
output: {
|
|
|
|
devtoolNamespace: 'wc',
|
|
|
|
path: path.resolve( __dirname, '../build/' ),
|
|
|
|
filename: `[name].js`,
|
|
|
|
// This fixes an issue with multiple webpack projects using chunking
|
|
|
|
// overwriting each other's chunk loader function.
|
|
|
|
// See https://webpack.js.org/configuration/output/#outputjsonpfunction
|
|
|
|
jsonpFunction: 'webpackWcBlocksPaymentMethodExtensionJsonp',
|
|
|
|
},
|
2020-11-09 10:44:58 +00:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
automaticNameDelimiter: '--',
|
|
|
|
},
|
|
|
|
},
|
2020-07-07 09:05:06 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader?cacheDirectory',
|
|
|
|
options: {
|
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
modules: false,
|
|
|
|
targets: {
|
|
|
|
browsers: [
|
|
|
|
'extends @wordpress/browserslist-config',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-object-rest-spread'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-transform-react-jsx'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-async-generator-functions'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-transform-runtime'
|
|
|
|
),
|
|
|
|
require.resolve(
|
|
|
|
'@babel/plugin-proposal-class-properties'
|
|
|
|
),
|
|
|
|
NODE_ENV === 'production'
|
|
|
|
? require.resolve(
|
|
|
|
'babel-plugin-transform-react-remove-prop-types'
|
|
|
|
)
|
|
|
|
: false,
|
|
|
|
].filter( Boolean ),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-07-22 12:05:56 +00:00
|
|
|
{
|
|
|
|
test: /\.s[c|a]ss$/,
|
|
|
|
use: {
|
|
|
|
loader: 'ignore-loader',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new ProgressBarPlugin(
|
|
|
|
getProgressBarPluginConfig(
|
|
|
|
'Payment Method Extensions',
|
|
|
|
options.fileSuffix
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new DependencyExtractionWebpackPlugin( {
|
|
|
|
injectPolyfill: true,
|
|
|
|
requestToExternal,
|
|
|
|
requestToHandle,
|
|
|
|
} ),
|
|
|
|
new NormalModuleReplacementPlugin(
|
|
|
|
/dashicon/,
|
|
|
|
( result ) => ( result.resource = dashIconReplacementModule )
|
|
|
|
),
|
|
|
|
],
|
|
|
|
resolve,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const getStylingConfig = ( options = {} ) => {
|
|
|
|
let { fileSuffix } = options;
|
|
|
|
const { alias, resolvePlugins = [] } = options;
|
|
|
|
fileSuffix = fileSuffix ? `-${ fileSuffix }` : '';
|
|
|
|
const resolve = alias
|
|
|
|
? {
|
|
|
|
alias,
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
plugins: resolvePlugins,
|
|
|
|
};
|
|
|
|
return {
|
|
|
|
entry: getEntryConfig( 'styling', options.exclude || [] ),
|
|
|
|
output: {
|
|
|
|
devtoolNamespace: 'wc',
|
|
|
|
path: path.resolve( __dirname, '../build/' ),
|
|
|
|
filename: `[name]-style${ fileSuffix }.js`,
|
|
|
|
library: [ 'wc', 'blocks', '[name]' ],
|
|
|
|
libraryTarget: 'this',
|
|
|
|
// This fixes an issue with multiple webpack projects using chunking
|
|
|
|
// overwriting each other's chunk loader function.
|
|
|
|
// See https://webpack.js.org/configuration/output/#outputjsonpfunction
|
|
|
|
jsonpFunction: 'webpackWcBlocksJsonp',
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
minSize: 0,
|
2020-11-09 10:44:58 +00:00
|
|
|
automaticNameDelimiter: '--',
|
2020-07-22 12:05:56 +00:00
|
|
|
cacheGroups: {
|
|
|
|
editor: {
|
2020-09-02 08:21:46 +00:00
|
|
|
// Capture all `editor` stylesheets and editor-components stylesheets.
|
2020-07-22 12:05:56 +00:00
|
|
|
test: ( module = {} ) =>
|
|
|
|
module.constructor.name === 'CssModule' &&
|
|
|
|
( findModuleMatch( module, /editor\.scss$/ ) ||
|
|
|
|
findModuleMatch(
|
|
|
|
module,
|
2020-09-02 08:21:46 +00:00
|
|
|
/[\\/]assets[\\/]js[\\/]editor-components[\\/]/
|
2020-07-22 12:05:56 +00:00
|
|
|
) ),
|
|
|
|
name: 'editor',
|
|
|
|
chunks: 'all',
|
|
|
|
priority: 10,
|
|
|
|
},
|
|
|
|
'vendors-style': {
|
|
|
|
test: /\/node_modules\/.*?style\.s?css$/,
|
|
|
|
name: 'vendors-style',
|
|
|
|
chunks: 'all',
|
|
|
|
priority: 7,
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
// Capture all stylesheets with name `style` or
|
|
|
|
// name that starts with underscore (abstracts).
|
|
|
|
test: /(style|_.*)\.scss$/,
|
|
|
|
name: 'style',
|
|
|
|
chunks: 'all',
|
|
|
|
priority: 5,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\/node_modules\/.*?style\.s?css$/,
|
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
|
|
|
{ loader: 'css-loader', options: { importLoaders: 1 } },
|
|
|
|
'postcss-loader',
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
2021-01-07 12:40:00 +00:00
|
|
|
options: {
|
|
|
|
sassOptions: {
|
|
|
|
includePaths: [ 'node_modules' ],
|
|
|
|
},
|
|
|
|
additionalData: ( content ) => {
|
|
|
|
const styleImports = [
|
|
|
|
'colors',
|
|
|
|
'breakpoints',
|
|
|
|
'variables',
|
|
|
|
'mixins',
|
|
|
|
'animations',
|
|
|
|
'z-index',
|
|
|
|
]
|
|
|
|
.map(
|
|
|
|
( imported ) =>
|
|
|
|
`@import "~@wordpress/base-styles/${ imported }";`
|
|
|
|
)
|
|
|
|
.join( ' ' );
|
|
|
|
return styleImports + content;
|
|
|
|
},
|
2020-07-22 12:05:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-07-07 09:05:06 +00:00
|
|
|
{
|
|
|
|
test: /\.s?css$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
|
|
|
{ loader: 'css-loader', options: { importLoaders: 1 } },
|
|
|
|
'postcss-loader',
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
2021-01-07 12:40:00 +00:00
|
|
|
options: {
|
|
|
|
sassOptions: {
|
|
|
|
includePaths: [ 'assets/css/abstracts' ],
|
|
|
|
},
|
|
|
|
additionalData: ( content, loaderContext ) => {
|
|
|
|
const {
|
|
|
|
resourcePath,
|
|
|
|
rootContext,
|
|
|
|
} = loaderContext;
|
|
|
|
const relativePath = path.relative(
|
|
|
|
rootContext,
|
|
|
|
resourcePath
|
|
|
|
);
|
|
|
|
|
|
|
|
if (
|
|
|
|
relativePath.startsWith(
|
|
|
|
'assets/css/abstracts/'
|
|
|
|
)
|
|
|
|
) {
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
'@import "_colors"; ' +
|
|
|
|
'@import "_variables"; ' +
|
|
|
|
'@import "_breakpoints"; ' +
|
|
|
|
'@import "_mixins"; ' +
|
|
|
|
content
|
|
|
|
);
|
|
|
|
},
|
2020-07-07 09:05:06 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
2020-07-22 12:05:56 +00:00
|
|
|
new ProgressBarPlugin(
|
|
|
|
getProgressBarPluginConfig( 'Styles', options.fileSuffix )
|
|
|
|
),
|
2020-07-07 09:05:06 +00:00
|
|
|
new WebpackRTLPlugin( {
|
2020-07-22 12:05:56 +00:00
|
|
|
filename: `[name]${ fileSuffix }-rtl.css`,
|
2020-07-07 09:05:06 +00:00
|
|
|
minify: {
|
|
|
|
safe: true,
|
|
|
|
},
|
|
|
|
} ),
|
|
|
|
new MiniCssExtractPlugin( {
|
2020-07-22 12:05:56 +00:00
|
|
|
filename: `[name]${ fileSuffix }.css`,
|
2020-07-07 09:05:06 +00:00
|
|
|
} ),
|
2020-07-22 12:05:56 +00:00
|
|
|
// Remove JS files generated by MiniCssExtractPlugin.
|
|
|
|
new RemoveFilesPlugin( `./build/*style${ fileSuffix }.js` ),
|
2020-07-07 09:05:06 +00:00
|
|
|
],
|
|
|
|
resolve,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getCoreConfig,
|
|
|
|
getFrontConfig,
|
|
|
|
getMainConfig,
|
|
|
|
getPaymentsConfig,
|
2020-07-22 12:05:56 +00:00
|
|
|
getStylingConfig,
|
2020-07-07 09:05:06 +00:00
|
|
|
};
|