scripts – Compile a blocks src directory and main index.js entry file and output to different build dirs?
Question
I have one entry file containing global libs and scripts for the site at /src/index.js
and a directory in my theme root at namespace-blocks
containing dirs for each block with block.json
‘s and index.js
‘s in each directory. Can I use wp-scripts without extending it with a webpack config to compile both into separate directories?
Using npm i concurrently
i’m able to do this and just output each build to separate build directories in my theme root like build
and build-blocks
but this isn’t ideal.
Currently my NPM scripts look like this:
"scripts": {
"start": "concurrently --kill-others \"npm run start:custom-directories\" \"npm run start:custom\"",
"start:custom-directories": "wp-scripts start --webpack-copy-php --webpack-src-dir=diesel-blocks --output-path=build-blocks",
"start:custom": "wp-scripts start src/index.js --output-path=build"
},
0
2 months
2022-06-12T16:44:16-05:00
2022-06-12T16:44:16-05:00 0 Answers
0 views
0
Leave an answer