Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...defaultConfig.module,
rules: [
...defaultConfig.module.rules,
{
test: /\.css$/,
use: [
// prettier-ignore
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
],
},
],
},
plugins: [
...defaultConfig.plugins,
new MiniCssExtractPlugin( {
filename: '../css/[name]-compiled.css',
} ),
new RtlCssPlugin( {
filename: '../css/[name]-compiled-rtl.css',
} ),
],
};
const adminBar = {
...defaultConfig,
...sharedConfig,
entry: {
'admin-bar': [ './assets/src/js/admin-bar/index.js' ],
},
plugins: [
...defaultConfig.module,
rules: [
...defaultConfig.module.rules,
{
test: /\.css$/,
use: [
// prettier-ignore
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
],
},
],
},
plugins: [
...defaultConfig.plugins,
new MiniCssExtractPlugin( {
filename: '../css/[name]-compiled.css',
} ),
new RtlCssPlugin( {
filename: '../css/[name]-compiled-rtl.css',
} ),
],
};
const blockEditor = {
...defaultConfig,
...sharedConfig,
entry: {
'block-editor': [
'./assets/src/block-editor/index.js',
'./assets/css/src/block-editor.css',
// @see https://webpack.js.org/loaders/sass-loader/#extracting-style-sheets
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader" // compiles Sass to CSS, using Node Sass by default
]
},
{
test: /.svg$/,
use: {
loader: "svg-react-loader"
}
}
]
},
plugins: [
...defaultConfig.plugins,
// @see https://webpack.js.org/loaders/sass-loader/#extracting-style-sheets
new MiniCssExtractPlugin({
filename: "[name].css"
})
],
externals: {
...defaultConfig.externals,
backbone: "Backbone"
}
};
// Create the full configuration for files that will include all the dependencies to keep WordPress pre 5.0.0 compatibility.
const webpackConfigFull = { ...webpackConfig };
// Remove the `DependencyExtractionWebpackPlugin`.
webpackConfigFull.plugins = webpackConfig.plugins.filter(
entry => !(entry instanceof DependencyExtractionWebpackPlugin)
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}
]
}
]
},
plugins: [
...defaultConfig.plugins,
new CopyPlugin({
patterns: [
{ from: './src/fonts', to: 'fonts' },
{ from: './src/images', to: 'images' },
{ from: './src/libraries/css', to: 'css/libraries' },
{ from: './src/fonts', to: 'css/fonts' },
{ from: './src/libraries/js', to: 'js/libraries' },
],
}),
],
};
plugins.forEach( ( plugin, index ) => {
if ( 'MiniCssExtractPlugin' === plugin.constructor.name ) {
config.plugins.splice( index, 1 );
}
} );
{
test: /editor\.scss$/,
use: styleExtractConfig,
},
],
},
stats: {
...defaultConfig.stats,
modules: false,
warnings: false,
},
plugins: [
...defaultConfig.plugins,
new FixStyleOnlyEntriesPlugin(),
new MiniCssExtractPlugin( {
filename: '[name].css',
} ),
],
};
/node_modules/,
],
loader: 'ts-loader',
},
{
enforce: 'pre',
test: /\.js$/,
exclude: [
/node_modules/,
],
loader: 'source-map-loader',
},
],
},
plugins: [
...defaultConfig.plugins,
new BellOnBundlerErrorPlugin(),
new webpack.ProvidePlugin({
react: 'react',
}),
],
};
module.exports = ( { css = [], js = [], prefix = 'llms-', outputPath = 'assets/', srcPath = 'src/' } ) => {
return {
...config,
entry: setupEntry( js, srcPath ),
output: {
filename: `js/${ prefix }[name].js`,
path: path.resolve( process.cwd(), outputPath ),
},
plugins: setupPlugins( config.plugins, css, prefix ),
};
}
name: 'Admin',
color: '#67b255',
} ),
],
};
const customizer = {
...defaultConfig,
...sharedConfig,
entry: {
'amp-customize-controls': './assets/src/customizer/amp-customize-controls.js',
'amp-customize-preview': './assets/src/customizer/amp-customize-preview.js',
'amp-customizer-design-preview': './assets/src/customizer/amp-customizer-design-preview.js',
},
plugins: [
...defaultConfig.plugins,
new WebpackBar( {
name: 'Customizer',
color: '#f27136',
} ),
],
};
const wpPolyfills = {
...defaultConfig,
...sharedConfig,
externals: {},
plugins: [
new DependencyExtractionWebpackPlugin( {
useDefaults: false,
requestToHandle: ( request ) => {
switch ( request ) {