2
0
Fork 0
mirror of https://github.com/elementor/hello-theme.git synced 2026-03-05 14:52:51 +08:00
hello-theme/webpack.config.js
2025-04-03 18:05:27 +08:00

52 lines
2.1 KiB
JavaScript

// WordPress webpack config.
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
// Plugins.
const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' );
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
// Utilities.
const path = require( 'path' );
const imagesPath = path.resolve( __dirname, './build/images' );
const modulesDir = process.cwd() + '/modules/';
const scssPath = path.resolve( __dirname, './assets/scss' );
const entryPoints = {
'../css/reset': path.resolve( scssPath, 'reset.scss' ),
'../css/theme': path.resolve( scssPath, 'theme.scss' ),
'../css/header-footer': path.resolve( scssPath, 'header-footer.scss' ),
'../css/editor': path.resolve( scssPath, 'editor.scss' ),
'../css/editor-styles': path.resolve( scssPath, 'editor-styles.scss' ),
'../css/customizer': path.resolve( scssPath, 'customizer.scss' ),
'hello-editor': path.resolve( __dirname, './assets/dev/js/editor/hello-editor.js' ),
'hello-frontend': path.resolve( __dirname, './assets/dev/js/frontend/hello-frontend.js' ),
'hello-home-app': path.resolve( __dirname, './modules/admin-home/assets/js//hello-elementor-admin.js' ),
'hello-elementor-menu': path.resolve( __dirname, './modules/admin-home/assets/js//hello-elementor-menu.js' ),
'hello-elementor-settings': path.resolve( __dirname, './modules/admin-home/assets/js//hello-elementor-settings.js' ),
'hello-elementor-topbar': path.resolve( __dirname, './modules/admin-home/assets/js/hello-elementor-topbar.js' ),
'hello-conversion-banner': path.resolve( __dirname, './modules/admin-home/assets/js//hello-elementor-conversion-banner.js' ),
};
module.exports = {
...defaultConfig,
...{
entry: entryPoints,
output: {
...defaultConfig.output,
path: path.resolve( __dirname, './assets/js' ),
},
plugins: [
// Include WP's plugin config.
...defaultConfig.plugins,
// Removes the empty `.js` files generated by webpack but
// sets it after WP has generated its `*.asset.php` file.
new RemoveEmptyScriptsPlugin( {
stage: RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS,
} ),
],
},
};