marko-js / marko

A declarative, HTML-based language that makes building web apps fun

Home Page:https://markojs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Webpack error on Marko versions greater than 5.31.0

hereticjsorg opened this issue · comments

Marko Version: 5.31.4

Details

On a versions of Marko NPM package starting from 5.31.1, there is an error while building a Marko hybrid project (server + browser).

Expected Behavior

No errors in the console.

Actual Behavior

In the browser console, I'm getting the following error:

index-webpack.js:2 Uncaught ReferenceError: __webpack_is_included__ is not defined
    at ./node_modules/marko/src/node_modules/@internal/require/index-webpack.js (index-webpack.js:2:1)
    at __webpack_require__ (bootstrap:19:1)
    at ./node_modules/marko/src/node_modules/@internal/components-registry/index-browser.js (index-browser.js:11:11)
    at __webpack_require__ (bootstrap:19:1)
    at ./node_modules/marko/src/node_modules/@internal/components-entry/index-browser.js (index-browser.js:1:16)
    at __webpack_require__ (bootstrap:19:1)
    at ./node_modules/marko/src/runtime/components/index.js (index.js:1:1)
    at __webpack_require__ (bootstrap:19:1)
    at ./site/modules/sample/home/server.marko?browser-entry (index.marko:11:6)
    at __webpack_require__ (bootstrap:19:1)

Possible Fix

Some webpack-related changes?

Your Environment

Debian Linux 12 or Mac OS Ventura 13.04
32 GB RAM
Node v20.5.1 and v19.4.0

Steps to Reproduce

  1. Clone https://github.com/hereticjsorg/heretic
  2. npm install
  3. npm run configure
  4. npm i marko@5.31.4 --save-dev
  5. npm run build -- --dev && npm run server
  6. Open up http://127.0.0.1:3001 -- you will see the error in the browser console
  7. npm i marko@5.31.0 --save-dev
  8. npm run build -- --dev && npm run server
  9. Open up http://127.0.0.1:3001 -- you will see NO error in the browser console

Stack Trace

See above

Seems like the webpack cannot find the internal modules:

module.exports = require("@internal/components-entry");

Workaround is to define the following in the webpack config:

new webpack.DefinePlugin({
   __webpack_is_included__: () => {},
}),

But that's no good.

@xtremespb @hereticjsorg thanks for the report, I'll get out a fix later today!

Fixed in the latest release!

Awesome, thank you very much 😎