Parcel: 馃悰 Hello World don't work

Created on 15 Apr 2018  路  7Comments  路  Source: parcel-bundler/parcel

馃悰 Bug report

馃帥 Configuration (.babelrc, package.json, cli command)


my package.json:

{
  "name": "parcel-bundler",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "parcel-bundler": "^1.7.0"
  }
}

馃 Expected Behavior


I'm running the hello world example provided from the parcel.org, the expected behavior is that:

console.log(classes.main);

prints the style object.

馃槸 Current Behavior


The current behavior is that I got an undefined.
captura de pantalla 2018-04-14 a la s 6 57 47 p m
馃樋

馃拋 Possible Solution


Maybe I should install parcel globally?, I'm using locally:

npx parcel index.html

But I don't think so 馃

馃敠 Context


I'm running the hello world example!! 馃樉

馃捇 Code Sample


captura de pantalla 2018-04-14 a la s 6 47 49 p m

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.7.0
| Node | 9.0
| npm/Yarn | 5.6.0/1.3.2
| Operating System | MacBook Pro 2017

Waiting Question

Most helpful comment

You have a typo in your css file you forgot the dot in front of main

Your css should be:

.main {
  background: url('./images/background.png');
  color: red;
}

Instead of this

main {
  background: url('./images/background.png');
  color: red;
}

All 7 comments

There must have been a breaking change somewhere, as this is indeed a bug I can easily reproduce

Hey @nicoandresr , CSS modules are not enabled by default. To use them, you should create a .postcssrc file with the following content:

{
  "modules": true
}

Make sure to delete the .cache folder in your project if it doesn't work. Here is the link to the docs on this: https://parceljs.org/transforms.html#postcss.

Hello @ronami thank u for your help, but with the .postcssrc does not work either 馃樋

I can confirm that adding modules: true enables this behaviour.
I actually didn't expect the getting started hello world example to utilise a plugin, therefore the false bug flagging.

@nicoandresr Remove the .cache folder, it'll not have the config file watched as u had none before

Hi @DeMoorJasper but I can't do that it works 馃樋, I need install postcss globally?, I removed the project and start again but don't work, please check my project.

You have a typo in your css file you forgot the dot in front of main

Your css should be:

.main {
  background: url('./images/background.png');
  color: red;
}

Instead of this

main {
  background: url('./images/background.png');
  color: red;
}

@DeMoorJasper works, ok thank you very much, sorry for my mistake! 馃槄
captura de pantalla 2018-04-16 a la s 8 05 52 a m

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dsky1990 picture dsky1990  路  3Comments

algebraic-brain picture algebraic-brain  路  3Comments

termhn picture termhn  路  3Comments

oliger picture oliger  路  3Comments

jzimmek picture jzimmek  路  3Comments