Open scottmessinger opened 3 years ago
We were running into this issue with an internal addon too. Having played around with our config and dug into the trace it looks like getPropertyDescriptor
and Object.processRule
inside the webpack bundle are of most interest and point to a particular css rule not being parseable.
From your package.json it looks like you too are using postcss
and tailwind
so I suspect your production build issue may be related to postcss at-rule
s not being understood. @tailwind
and @apply
, if not unravelled by postcss by the time webpack wants to produce a bundle, may be what's causing the issue - in our case (as we're still working on reaching postcss compatibility), removing all @apply
invocations fixed the production build error.
As an aside, the top level error for this is a bit opaque (TypeError: needed by index.html: Cannot read property '0' of undefined
) so perhaps it could be improved with a bit more context on what part of the webpack bundle stage is falling over.
Hi! I'm trying to build in production (
ember build --environment=production
) and am getting this error:Here's my package.json
```json { "devDependencies": { "@ember/optional-features": "^2.0.0", "@ember/render-modifiers": "^1.0.2", "@embroider/compat": "^0.35.1", "@embroider/core": "^0.35.1", "@embroider/webpack": "^0.35.1", "@glimmer/component": "^1.0.1", "@glimmer/tracking": "^1.0.1", "@types/ember": "^3.16.1", "@types/ember-qunit": "^3.4.12", "@types/ember-resolver": "^5.0.10", "@types/ember__test-helpers": "^1.7.3", "@types/qunit": "^2.9.5", "@typescript-eslint/parser": "^4.4.0", "babel-eslint": "^8.0.0", "broccoli-asset-rev": "^3.0.0", "ember-animated": "^0.10.1", "ember-auto-import": "^1.6.0", "ember-cli": "~3.21.2", "ember-cli-app-version": "^3.2.0", "ember-cli-babel": "^7.22.1", "ember-cli-bundle-analyzer": "^0.2.1", "ember-cli-dependency-checker": "^3.2.0", "ember-cli-deploy": "^1.0.2", "ember-cli-deploy-build": "^2.0.0", "ember-cli-deploy-display-revisions": "^2.1.2", "ember-cli-deploy-revision-data": "commoncurriculum/ember-cli-deploy-revision-data", "ember-cli-deploy-s3": "^3.0.0", "ember-cli-deploy-s3-prember": "github:commoncurriculum/ember-cli-deploy-s3-prember#b7af484bc99938c3b2ce0a3666e1060a19cea038", "ember-cli-fastboot": "^3.0.0-beta.2", "ember-cli-htmlbars": "^5.3.1", "ember-cli-inject-live-reload": "^2.0.2", "ember-cli-segment": "^4.1.0", "ember-cli-sri": "^2.1.1", "ember-cli-string-helpers": "^5.0.0", "ember-cli-terser": "^4.0.0", "ember-cli-typescript": "^4.0.0", "ember-cli-typescript-blueprints": "^3.0.0", "ember-composable-helpers": "^4.3.0", "ember-could-get-used-to-this": "^1.0.1", "ember-css-modules": "^1.3.2", "ember-decorators": "^6.1.1", "ember-export-application-global": "^2.0.1", "ember-fetch": "^8.0.2", "ember-load-initializers": "^2.1.1", "ember-math-helpers": "^2.15.0", "ember-maybe-import-regenerator": "^0.1.6", "ember-modifier": "^2.1.1", "ember-page-title": "^6.0.1", "ember-qunit": "^4.6.0", "ember-resolver": "^8.0.2", "ember-source": "~3.23.1", "ember-template-lint": "^2.13.0", "ember-template-lint-plugin-prettier": "^2.0.0", "ember-truth-helpers": "^3.0.0", "ember-welcome-page": "^4.0.0", "eslint": "^7.8.0", "eslint-plugin-ember": "^8.13.0", "eslint-plugin-node": "^11.1.0", "loader.js": "^4.7.0", "lodash-es": "^4.17.15", "npm-run-all": "^4.1.5", "postcss": "^7.0.35", "postcss-import": "^12.0.1", "postcss-nested": "^4.2.3", "prember": "github:simonihmig/prember#embroider", "prember-middleware": "^0.1.0", "prettier": "^2.1.2", "qunit-dom": "^1.4.0", "tailwindcss": "^1.8.12", "tracked-built-ins": "^1.0.2", "typescript": "^4.0.3" }, "engines": { "node": "10.* || >= 12" }, "ember": { "edition": "octane" }, "dependencies": { "@embroider/router": "^0.35.1", "@sentry/browser": "^5.29.1", "@types/lodash-es": "^4.17.3", "@types/prismic-dom": "^2.1.1", "macro-decorators": "^0.1.2", "prismic-dom": "^2.2.4", "webpack-bundle-analyzer": "^3.9.0" }, } ```Here's the error
```sh ================================================================================= ERROR Summary: - broccoliBuilderErrorStack: TypeError: needed by index.html: Cannot read property '0' of undefined at getPropertyDescriptor (/Users/scottmessinger/code/commoncurriculum/v4/app/static-frontend/node_modules/css-tree/lib/utils/names.js:63:24) at getPropertyFingerprint (/Users/scottmessinger/code/commoncurriculum/v4/app/static-frontend/node_modules/csso/lib/restructure/6-restructBlock.js:72:20) at List.My guess: it's related to minifying css
Based on the stack trace, it appears be related to CSS processing. I wasn't getting this error on 0.27.0 and I'm also not getting it when I run
ember serve
-- it's only when I run it in with the production flag. This makes me think it might be caused by the change to minifying CSS in production environments.