Skip to content

Empty js file output from css entry #90

Closed

Description

Describe the bug
When a CSS entry point is added to package.json, webpack generates an empty .js file. For example, adding the entry "style": "./assets/css/style.css" outputs css/style.css 20 bytes js/style.js 0 bytes.

More info about this can be read in the issues webpack-contrib/mini-css-extract-plugin#151 and webpack-contrib/extract-text-webpack-plugin#518.

Steps to Reproduce

  1. Create a new npm project running npm init
  2. Install 10up-toolkit running npm install --save-dev 10up-toolkit
  3. Create a CSS file and add an entry point in package.json
...
"10up-toolkit": {
  "entry": {
   "style": "./assets/css/style.css"
  },
...
  1. Run 10up-toolkit build
  2. Check at the dist folder the files style.css and style.js

Expected behavior
Empty scripts removed from output.

Screenshots

Environment information

  • Device:
  • OS:
  • Browser and version:
  • WordPress version:
  • Plugins and version:
  • Theme and version:
  • Site Health Info:

Additional context
A possible workaround is importing CSS file into a JS file. However, there are cases when CSS doesn't have a correspondent JS file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions