odoo / owl

OWL: A web framework for structured, dynamic and maintainable applications
https://odoo.github.io/owl/
Other
1.16k stars 346 forks source link

Owl Tutorial setting issue #879

Closed guidev224 closed 3 years ago

guidev224 commented 3 years ago

Hello,

I am trying to follow the owl tutorial for beginner and have copied the content of this file OWL JS FILE

But I am getting this error Uncaught ReferenceError: exports is not defined. at this line Object.defineProperty(exports, '__esModule', { value: true }); I have even installed node js on my machine but still getting the error

I have followed thoroughly the tutorial guide

App Structure

todoapp/
    index.html
    app.css
    app.js
    owl.js

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>OWL Todo App</title>
    <link rel="stylesheet" href="app.css" />
    <script src="owl.js"></script>
    <script src="app.js"></script>
  </head>
  <body></body>
</html>

app.js

(function () {
    console.log("hello owl", owl.__info__.version);
  })();
ged-odoo commented 3 years ago

you should take the iife version (same file name, but with iife). The cjs is for use in bundlers/other kind of tooling. Sorry, the js ecosystem is kind of a mess! We should add a note to clarify that in the tutorial.

guidev224 commented 3 years ago

@ged-odoo thanks for your response. I'll give it try