Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS/CSS files in create-block are not be built #38343

Closed
hit1205 opened this issue Jan 29, 2022 · 7 comments
Closed

JS/CSS files in create-block are not be built #38343

hit1205 opened this issue Jan 29, 2022 · 7 comments
Labels
[Package] Scripts /packages/scripts [Tool] Create Block /packages/create-block [Type] Regression Related to a regression in the latest release

Comments

@hit1205
Copy link

hit1205 commented Jan 29, 2022

Description

I followed the steps on WordPress site's Create a Block Tutorial page to create a plugin.

I installed the @wordpress/create-block package (v2.8.0, the lastest version) and found that there's only one file, project-folder/build/block.json, in the build folder, other files like index.js, index.css are not be built after I run npm run build or npm start on project folder.

I have tried these versions, but the problem are still there:

  • nodejs v14.16.1 + npm v8.1.3
  • nodejs v14.18.1 + npm v6.14.15 (same as the tutorial page)
  • nodejs v16.13.2 + npm v8.1.2 (lastest version)

So I tried to install create-block v2.7.0 & v2.7.2-next.33ec3857e2.0, and found the problem is solved in these versions.

In these versions, the path of block.json is project-folder/block.json and all JS/CSS files are in project-folder/build/ correctly.

Step-by-step reproduction instructions

Use lastest version:

  1. Use npx @wordpress/create-block project-folder to install the package
  2. Use cd project-folder and npm start
  3. Change the file project-folder/src/index.js and the built file are not be shown in project-folder/build

Use old version:

  1. Use npx @wordpress/create-block@2.7.2-next.33ec3857e2.0 project-folder-2 to install the old package
  2. Use cd project-folder-2 and npm start
  3. Change the file project-folder-2/src/index.js and all the built files are shown in project-folder-2/build

Screenshots, screen recording, code snippet

No response

Environment info

  • OS: Windows 10.0.18363.1379

Tried nodejs/npm version:

  • nodejs v14.16.1 + npm v8.1.3
  • nodejs v14.18.1 + npm v6.14.15 (same as the tutorial page)
  • nodejs v16.13.2 + npm v8.1.2 (lastest version)

Tried @wordpress/create-block version:

  • 2.8.0 (the problem could be reproduced)
  • 2.7.2-next.33ec3857e2.0 (the problem could not be reproduced)
  • 2.7.0 (the problem could not be reproduced)

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@gziolo gziolo added [Tool] Create Block /packages/create-block Needs Testing Needs further testing to be confirmed. labels Jan 29, 2022
@gziolo
Copy link
Member

gziolo commented Jan 29, 2022

Tried @wordpress/create-block version:

2.8.0 (the problem could be reproduced)
2.7.2-next.33ec3857e2.0 (the problem could not be reproduced)
2.7.0 (the problem could not be reproduced)

This is very helpful. Thank you for testing previous versions. It’s very helpful 👍

@gziolo gziolo added the [Package] Scripts /packages/scripts label Jan 29, 2022
@muzafferkaya-gokalpay
Copy link

muzafferkaya-gokalpay commented Jan 29, 2022

I encountered with same issue:

when i use the "npx @wordpress/create-block some-block" the block is being created but webpack not emitting the scss and js files, only emtting the block.json file. So my block is not working. Is there a solution for that issue, pls?

(I use, node v17.4.0, webpack v8.4.0)

I also tried the solution above but it did not work for me.

@t-hamano
Copy link
Contributor

t-hamano commented Jan 30, 2022

I have encountered the exact same symptoms.

I think this is a problem specific to the Windows OS.

It occurs on the Windows host OS, but is not reproduced on WSL which is a Linux environment.

I expect that the glob expression in fast-glob v3.0.0 or later no longer converts backslashes (Windows separators) to forward slashes** and does not correctly detect the path of block.json.

I haven't been able to fully investigate what changes were made between v19 and v20, but I'll check it out.

@aurooba
Copy link
Member

aurooba commented Jan 30, 2022

Same issue over in #38357 (using wordpress/scripts), and definitely not isolated to just the Windows OS environment.

@gziolo gziolo added [Type] Regression Related to a regression in the latest release and removed Needs Testing Needs further testing to be confirmed. labels Jan 31, 2022
@gziolo
Copy link
Member

gziolo commented Jan 31, 2022

I have just landed #38348 which resolves the issues for Windows OS. I plan to publish it to npm later today.

@gziolo
Copy link
Member

gziolo commented Jan 31, 2022

Same issue over in #38357 (using wordpress/scripts), and definitely not isolated to just the Windows OS environment.

There are probably two different issues, but I can keep this one open until both are addressed.

@gziolo
Copy link
Member

gziolo commented Jan 31, 2022

I published a new version v20.0.2 of @wordpress/scripts to npm that improves the handling for the build command on Window OS. Let's close this issue for now. I will reopen as soon as people report more issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Scripts /packages/scripts [Tool] Create Block /packages/create-block [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

No branches or pull requests

5 participants