添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
读研的人字拖  ·  Java 读取 .properties ...·  1 年前    · 
豪气的冰淇淋  ·  C/C++ getnameinfo ...·  1 年前    · 
礼貌的消防车  ·  53. Endpoints·  3 年前    · 

ReferenceError: exports is not defined #2332

@jeffsaremi

Description

First off I don't even know if rollup is the tool i should be using or not.
I have a few TS files which are compiled into JS. I now want to avoid having to refer to run my code in Chrome browser. I don't care if my code runs in node.js or not.
If my assumption is correct then this is how i proceeded:

  • installed rollup using npm install -g
  • did a --help and it looked like the option --format iife is what i need
  • ran rollup against the entry script in a folder where only my js files resided:
    rollup test_entry.js --file bundle.js --format iife
  • referenced the resulting bundle.js in my html:
    <script src='bundle.js'></script>
  • launched the html file in chrome with the developer extension open.
  • i got the above error against this line:
    Object.defineProperty(exports, "__esModule", { value: true });
  •