Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stylus import statement breaks built-in bundler #1157

Closed
jpravetz opened this issue Dec 9, 2019 · 2 comments · Fixed by #1158
Closed

Stylus import statement breaks built-in bundler #1157

jpravetz opened this issue Dec 9, 2019 · 2 comments · Fixed by #1158

Comments

@jpravetz
Copy link

@jpravetz jpravetz commented Dec 9, 2019

I'm submitting a bug report

  • Library Version:
    Local aurelia-cli v1.2.2

Please tell us about your environment:

  • Operating System:
    OSX 10.x

  • Node Version:
    v12.6.0

  • NPM Version:
    6.13.1

  • Browser:
    N/A

  • Language:
    TypeScript 3.7.3

  • Loader/bundler:
    SystemJS | RequireJS

Behavior:

Use of stylus @import statements appear to break the built-in bundler.

In this bare-bones sample project, in the file app.styl, if you add the line @import 'mixins.styl'; you will get the following error.

ERROR [Bundle] Failed to write the bundle
INFO [Bundle] Error: No element indexed by 0
... etc ...

To reproduce:

git clone git@github.com:jpravetz/au-pug-styl-test4.git
cd au-pug-styl-test4
npm install
npm run build

If you remove the @import line from app.styl then the project will build and run.

I am experiencing this same issue in multiple versions of the cli and with multiple projects that I've set up to isolate the problem.

Note

This sample project project demonstrates what I think is a related issue, which is that the bundler will try to bundle @types files, if imported into a .ts file using an import statement. The workaround is to list the type in the tsconfig types array. I didn't see this issue covered in the docs.

@3cp

This comment has been minimized.

Copy link
Member

@3cp 3cp commented Dec 9, 2019

It looks like you hit a postcss source map bug. We have encountered this with other setup with postcss.

Currently, you can bypass this issue by disabling source map with sourcemaps: false in your local aurelia_project/tasks/process-css.ts.

@3cp

This comment has been minimized.

Copy link
Member

@3cp 3cp commented Dec 9, 2019

Looks like this one is different from the other postcss issue. I can remove postcss but hit the the same issue.

Different from scss (which use _mixins.scss file name conventions to avoid _mixins.scss to generate an empty css output), gulp-stylus generated an empty css from mixins.styl file, which somehow hit some source map bug.

I will get back to you with a fix.

3cp added a commit that referenced this issue Dec 9, 2019
@3cp 3cp closed this in #1158 Dec 9, 2019
3cp added a commit that referenced this issue Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.