Skip to content

Commit a879ff2

Browse files
committed
Copy assets from resources using webpack copy plugin
1 parent df54f6b commit a879ff2

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ node_modules
55
composer.lock
66
yarn-error.log
77
modules/ppcp-button/assets/*
8-
modules/ppcp-onboarding/assets/js/*
8+
modules/ppcp-onboarding/assets/*
99
modules/ppcp-wc-gateway/assets/*
1010
.idea/
1111
*.zip

modules/ppcp-onboarding/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"devDependencies": {
2121
"@wordpress/scripts": "^12.2.1",
2222
"@woocommerce/eslint-plugin": "1.1.0",
23-
"@woocommerce/dependency-extraction-webpack-plugin": "1.5.0"
23+
"@woocommerce/dependency-extraction-webpack-plugin": "1.5.0",
24+
"copy-webpack-plugin": "5.1.2"
2425
},
2526
"dependencies": {
2627
"@woocommerce/components": "^6.1.2",

modules/ppcp-onboarding/webpack.config.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
const path = require( 'path' );
2+
const CopyPlugin = require( 'copy-webpack-plugin' );
23
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
34
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
45

56
module.exports = {
67
...defaultConfig,
78
entry: {
8-
onboarding: path.resolve( './resources/js/onboarding.js' ),
99
'task-list-fill': path.resolve(
1010
'./resources/js/task-list/task-list-fill.js'
1111
),
12-
settings: path.resolve( './resources/js/settings.js' ),
1312
},
1413
output: {
1514
path: path.resolve( __dirname, 'assets/js/' ),
@@ -21,5 +20,16 @@ module.exports = {
2120
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
2221
),
2322
new WooCommerceDependencyExtractionWebpackPlugin(),
23+
new CopyPlugin( [
24+
{
25+
from: path.resolve( './resources/js' ),
26+
to: path.resolve( __dirname, 'assets/js' ),
27+
ignore: [ 'task-list/**/*' ],
28+
},
29+
{
30+
from: path.resolve( './resources/css' ),
31+
to: path.resolve( __dirname, 'assets/css' ),
32+
},
33+
] ),
2434
],
2535
};

0 commit comments

Comments
 (0)