ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.51k stars 783 forks source link

Rollup died #745

Closed AmitMY closed 6 years ago

AmitMY commented 6 years ago

Stencil version:

 @stencil/core@0.7.24

I'm submitting a:

[x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Current behavior: Adding this to my code:

import Cesium from 'cesium';

this.map = new Cesium.Viewer(mapId, {
      scene3DOnly: true,
      selectionIndicator: false,
      baseLayerPicker: false
    });

I get:

[ ERROR ] bundling: node_modules/requirejs/bin/r.js, line: 1 Unexpected character '#' (1:0) in /Users/admin/dev/map-leaflet/node_modules/requirejs/bin/r.js

  L1:  #!/usr/bin/env node

[ ERROR ] rollup died at /Users/admin/dev/map-leaflet/node_modules/@stencil/core/dist/compiler/index.js:16780:19 at Generator.throw () at rejected (/Users/admin/dev/map-leaflet/node_modules/@stencil/core/dist/compiler/index.js:16738:65) at

Expected behavior: Rollup should live

jgw96 commented 6 years ago

Hey @AmitMY from that error, it looks like this is coming from the map-leaflet library. Are you importing that lib anywhere?

AmitMY commented 6 years ago

map-leaflet is my folder name, not a package. The erroring library is requirejs.

I have a webpack project with this code, works fine

jgw96 commented 6 years ago

Hey @AmitMY , mind putting together a repo we can use to reproduce this?

AmitMY commented 6 years ago

I can’t make one today, so super simple: Clone ionic-pwa repo Add the above code to app-home

jthoms1 commented 6 years ago

Could you please test this with v0.7.26? This has the newer Rollup release.

AmitMY commented 6 years ago

@jthoms1 Tried 0.7.26, Rollup died again

jthoms1 commented 6 years ago

What OS are you on?

AmitMY commented 6 years ago

@jthoms1 macOS 10.13.4

jthoms1 commented 6 years ago

PR #760 should resolve this issue. Please update your config to the following. Note that the only change was adding nodeResolve with browser as true.

This PR is not in a released version yet, but should be today.

This is per the documentation provided by rollup-plugin-node-resolve. https://github.com/rollup/rollup-plugin-node-resolve#usage

exports.config = {
  nodeResolve: {
    browser: true
  }
};

exports.devServer = {
  root: 'www',
  watchGlob: '**/**'
};
AmitMY commented 6 years ago

@jthoms1 v0.8.0 same error.

jthoms1 commented 6 years ago

@AmitMY did you make the configuration changes outlined above? Can you provide the error again after making these changes?

kraftwer1 commented 6 years ago

@AmitMY I'm facing a similar issue using v0.9.1. I'm trying to import TweenLite from gsap:

import { TweenLite } from "gsap" // works fine using Webpack

I also tried adding nodeResolve: { browser: true }, but with no effect.

> sd concurrent "stencil build --dev --watch" "stencil-dev-server --no-open"

[15:55.0]  @stencil/core v0.9.1 🍁
[15:55.0]  build, app, dev mode, started ...
[15:55.0]  compile started ...
[15:56.7]  compile finished in 1.71 s
[15:56.7]  module map started ...
{ Error: 'TweenLite' is not exported by node_modules/gsap/TweenMax.js
    at error (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:199:15)
    at Module.error (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:16947:9)
    at handleMissingExport (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:17256:21)
    at /Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:20057:56
    at Array.reduce (<anonymous>)
    at Graph.handleMissingExport (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:20056:27)
    at Module.traceVariable (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:17030:28)
    at ModuleScope.findVariable (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:13443:29)
    at Scope.findVariable (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:13375:68)
    at FunctionScope.Scope.findVariable (/Users/kraftwer1/test/node_modules/rollup/dist/rollup.js:13375:68)
  code: 'MISSING_EXPORT',
  url: 'https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module',
  pos: 9,
  loc:
   { file: '/Users/kraftwer1/test/__tmp__in__memory__/menu-flyout-item-group/menu-flyout-item-group.js',
     line: 1,
     column: 9 },
  frame: '1: import { TweenLite } from "gsap";\n            ^\n2: export class MenuFlyoutItemGroup {\n3:     // private animationDuration = 0.3' }
[15:57.4]  module map finished in 726 ms

[ ERROR ]  bundling: __tmp__in__memory__/menu-flyout-item-group/menu-flyout-item-group.js, line: 1
           'TweenLite' is not exported by node_modules/gsap/TweenMax.js

      L1:  import { TweenLite } from "gsap";
      L2:  export class MenuFlyoutItemGroup {

[ ERROR ]  rollup died at /Users/kraftwer1/test/node_modules/@stencil/core/dist/compiler/index.js:17607:19 at
           Generator.throw (<anonymous>) at rejected
           (/Users/kraftwer1/test/node_modules/@stencil/core/dist/compiler/index.js:17566:65) at <anonymous>

[15:57.5]  build failed, watching for changes... in 2.56 s
jthoms1 commented 6 years ago

@kraftwer1 Could you provide a simple repo that reproduces this so that I can troubleshoot your error? Thanks!

kraftwer1 commented 6 years ago

Just run „npm -i gsap“ and add it into the Stencil starter kit.

Am 16.05.2018 um 17:26 schrieb Josh Thomas notifications@github.com:

@kraftwer1 Could you provide a simple repo that reproduces this so that I can troubleshoot your error? Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

kraftwer1 commented 6 years ago

Reported to "gsap" as I think it's not a Stencil issue: greensock/GreenSock-JS#265

AmitMY commented 6 years ago

@jthoms1 I created a reproduction for you to be able to troubleshoot. https://github.com/AmitMY/stencil-rollup-bug-reproduction

Only the last commit is what I changed.

kraftwer1 commented 6 years ago

@jthoms1 @AmitMY gsap fixed their modules and now it works fine. So this could be closed. Thank you guys.

AmitMY commented 6 years ago

This shouldn't, my reproduction is not with gsap.