Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

format: esm breaks rollup static optimization #127

Open
ffflabs opened this issue Mar 28, 2017 · 1 comment
Open

format: esm breaks rollup static optimization #127

ffflabs opened this issue Mar 28, 2017 · 1 comment

Comments

@ffflabs
Copy link
Contributor

ffflabs commented Mar 28, 2017

given a jspm.config.js with meta

 meta: {
    "*.css": {
      "defaultExtension": false,
      "format": "amd",
      "loader": "css"
    }
  }

Doing

jspm build style.css style.js

Works fine. And it works fine using format = "cjs" too. But if I try to use format = "esm" to take advantage of Rollup static optimization:

 meta: {
    "*.css": {
      "defaultExtension": false,
      "format": "esm",
      "loader": "css"
    }
  }

It errors with message:

Error loading styles/public.css: load hook should return a string, a { code, map } object, or nothing/null
/my_project/node_modules/rollup/dist/rollup.js:8839:10

This is actually the expected result if the build module is actually a function
https://github.com/rollup/rollup/blob/d1c1126b1aca6f5b44772b1ddc19b1651dc78928/test/function/load-returns-string-or-null/_config.js

But I guess when "format":"esm", the translated output should be delivered to Rollup in a special way

@guybedford
Copy link
Member

This actually seems to work ok for me. This may have been fixed in the SystemJS builder patch recently, still pending release into jspm. The release should go out later today - if you can try again then, let me know if it seems fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants