cli: Error: Path variable [contenthash] not implemented in this context: [contenthash].css

I’m submitting a bug report

  • Library Version: 0.33.1

Please tell us about your environment:

  • Operating System: Windows 10

  • Node Version: 8.10.0

  • NPM Version: 5.8.0

  • Browser: all

  • Language: TypeScript X.X

  • Loader/bundler: Webpack

Current behavior:

  1. Using Windows 10, I create a new folder and open Powershell.

  2. au new --here with options: 3: Webpack 2: ASP.NET Core 2: Typescript 1: Default - No markeup processing 1: Default - Use standard css 1: None - Skip testing 2: No - Skip testing 1: Visual Studio Code 1: Yes (Default) - Creates the project structure… 1: Yes (Default) - Installs all server, client and tooling dependencies…

  3. Create app.css with content: body { background-color: red; }

  4. Include css in app.ts: import './app.css';

  5. au build --env prod gives: Error: Path variable [contenthash] not implemented in this context: [contenthash].css

It seems to be related to: https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/763

I have followed one suggestion from the above link and added mini-css-extract-plugin for latest webpack. This and a few other small changes make my experience with aurelia-cli now much better. Find my changes here: https://github.com/constructor/aurelia-cli-fixes

  • What is the expected behavior? To build without errors using latest libs. As a new user this was causing lots of unnecessary pain. It should just work.

  • What is the motivation / use case for changing the behavior? So it just works.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

tested with 4.12.0. issue is still there…

@Alexander-Taran After reading around about the wider issues caused by the webpack breaking changes, although my changes work (and I am currently using them) it does not seem to be the correct direction to take. I could elaborate but I will not here. In short the issue comes from the outside. The initial problem, that of newly installed aurelia-cli not working, can be fixed by changing how webpack is referenced in lib/dependencies.json webpack from "webpack": "^4.1.1" to "webpack": "4.1.1". This solves the major issues in one go (both ‘au run’ and build issues). A hotfix for this would take no time? It is after all a single character change. The other minor issues of css 404 out of the box and project cleaning will still remain, but they are not ‘breaking’ anything and are more minor annoyances for people who like a clean console 😃 I can update my repo tomorrow maybe.

@thomas-darling I agree. I’ll take a look

Do we know whether this will be fixed elsewhere, or what’s going on here? Seems the issue linked above (webpack-contrib/extract-text-webpack-plugin#763) was closed with a comment stating that we should use something else to extract CSS - which I assume means the CLI needs to be changed accordingly?

This really needs to work out of the box, and just locking the Webpack version is not a sustainable solution, as we’ll need the newer Webpack releases for other reasons.