parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.51k stars 2.27k forks source link

🐛 stylus image build error #673

Open ZZ-Zero opened 6 years ago

ZZ-Zero commented 6 years ago

Choose one: is this a 🐛 bug report or 🙋 feature request?

🎛 Configuration package.json

  "scripts": {
    "start": "rimraf ./dist && parcel ./src/index.html",
    "build": "rimraf ./dist && parcel build ./src/index.html"
  },
  "devDependencies": {
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "rimraf": "^2.6.2",
    "stylus": "^0.54.5"
  }

🤔 Expected Behavior

It's work

😯 Current Behavior

parcel ./src/index.html --no-cache
Server running at http://localhost:1234
✨  Built in 3.15s.

In dist, all background-image is

background-image: url("6ca929a9fe71b45e369a3d439a90e58e.");

not find this img file

In browser console

css-loader.js:31 Uncaught (in promise) Error: Cannot find module '54cb5b99c362480e7d815a6feae6722f.png,20'
    at newRequire (css-loader.js:31)
    at newRequire (css-loader.js:22)
    at localRequire (css-loader.js:31)
    at css-loader.js:31
    at <anonymous>

💁 Possible Solution

🔦 Context

💻 Code Sample

src
 | -- index.html
 | -- assets
      | -- img.jpg
      | -- common
             | -- xxx.jpg
             | -- xxx.jpg
             | -- xxx.jpg
 | -- style
      | -- index.styl
      | -- base.styl
      | -- common
             | -- xxx.styl
             | -- xxx.styl
             | -- xxx.styl

index.html

<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="./style/index.styl">
</head>
<body>

  <script src="./script/index.js"></script>
</body>
</html>

index.styl

@import "./base.styl"

base.styl

// baseStyle
@import "./common/**"

./common/xxx.styl

  .icon
    width .28rem
    height .26rem
    background url('../../assets/common/icon-share.png') center no-repeat
    background-size 100% 100%

🌍 Your Environment

Software Version(s)
Parcel 1.5.1
Node v8.9.4
npm/Yarn npm 5.6.0
Operating System OS X
0xDaksh commented 6 years ago

me too having a similar issue.

adityamandal commented 6 years ago

Same error

davidnagli commented 6 years ago

@aicest You’ve done some work with Stylus before. Do you think you can try looking into this?

0xDaksh commented 6 years ago

any progress on this? can we help?

davidnagli commented 6 years ago

@DakshMiglani Ya sure! Feel free to submit a PR 😃

0xDaksh commented 6 years ago

Alright I'll check on that, also the same bug is with sass.

0xDaksh commented 6 years ago

540