marko-js / webpack

A loader for marko files and a plugin for universal bundling
MIT License
13 stars 4 forks source link

Compilation errors starting with 8.0.1 #53

Closed J-Hoh closed 3 years ago

J-Hoh commented 3 years ago

Versions:

node 14.16.0 @marko/webpack version: 8.0.1 less-version: 4.1.1 (Published 2 months ago) less-loader-version: 8.1.0 (Published 4 days ago)

Details

Marko style blocks break with and without preprocessor (less). Separate style.css/style.less gets included. The following are two errors emitted during webpack compilation of the browser config:


Component Errors

The following component is a single file component, has a style.less and a class block.

ERROR in ./src/components/material-icon/material-icon.marko 6:0-161
Module not found: Error: Can't resolve '..\..\..\node_modules\@marko\webpack\dist\loader\index.js' in 'D:\PROJECT\src\components\material-icon' 

Entrypoint Errors

The following Entrypoint only has a style.less block apart from the "html" part

ERROR in ./src/error.marko?browser-entry 11:0-109
Module not found: Error: Can't resolve './index.marko?virtual=./index.marko.less' in 'D:\PROJECT\src'

Expected Behavior

In @marko/webpack version 7.1.4 "everything works™". Less gets compiled to CSS and output properly, components get properly loaded and overall javascript works.

Actual Behavior

Starting version 8.0.x the style blocks arent included in the output. This also breaks the javascript as a module is missing. Entrypoints with just html/js work, but including even a single style block - not even less and even on components - break browser js (see error below). CSS only works on subcomponents where it's split to a separate file.

Uncaught Error: Cannot find module './index.page.marko.less!=!..\..\node_modules\@marko\webpack\dist\loader\index.js!./index.page.marko?virtual=./index.page.marko.less'
xtremespb commented 3 years ago

Same for me.

ERROR in ../../../../src/shared/marko/src/error404/index.marko?virtual=./index.marko.scss (../../../../node_modules/@marko/webpack/dist/loader/index.js!../../../../src/shared/marko/src/error404/index.marko?virtual=./index.marko.scss)
  Module build failed (from ../../../../node_modules/@marko/webpack/dist/loader/index.js):
  SyntaxError: src\shared\marko\src\error404\index.marko(3,27): Unexpected token
    1 | import { t as _t } from "marko/src/runtime/vdom";
    2 |
  > 3 | var _marko_template = _t();
      |                           ^
    4 |
    5 | export default _marko_template;
    6 | import _zoia from "../../zoia/index.marko";
      at MarkoFile.buildCodeFrameError (C:\Users\mmatveev\Documents\Git\zoia\node_modules\@marko\compiler\dist\babel-plugin\file.js:37:17)
      at tryParse (C:\Users\mmatveev\Documents\Git\zoia\node_modules\@marko\babel-utils\dist\parse.js:33:18)
      at parseExpression (C:\Users\mmatveev\Documents\Git\zoia\node_modules\@marko\babel-utils\dist\parse.js:10:10)
      at C:\Users\mmatveev\Documents\Git\zoia\node_modules\@marko\compiler\dist\babel-plugin\util\parse-attributes.js:47:47
      at Array.map (<anonymous>)
      at _default (C:\Users\mmatveev\Documents\Git\zoia\node_modules\@marko\compiler\dist\babel-plugin\util\parse-attributes.js:9:21)
      at Parser.onOpenTag (C:\Users\mmatveev\Documents\Git\zoia\node_modules\@marko\compiler\dist\babel-plugin\parser.js:270:38)
      at notifyOpenTag (C:\Users\mmatveev\Documents\Git\zoia\node_modules\htmljs-parser\notify-util.js:167:27)
      at finishOpenTag (C:\Users\mmatveev\Documents\Git\zoia\node_modules\htmljs-parser\Parser.js:470:13)
      at Parser.char (C:\Users\mmatveev\Documents\Git\zoia\node_modules\htmljs-parser\Parser.js:2371:29)
   @ ../../../../src/shared/marko/src/error404/index.marko?browser-entry 2:0-86

Getting back to 7.1.4 makes it work. I can give more steps to reproduce when necessary.

DylanPiercey commented 3 years ago

Looks to be a Windows specific issue. We’ll be looking into this shortly, thanks for notifying us!

DylanPiercey commented 3 years ago

Hey @xtremespb and @J-Hoh, I think the @marko/webpack@9 release should fix this issue. If not I can dig further.

J-Hoh commented 3 years ago

Yep, latest 9.0.2 works ^^

NoDeployFriday

Thank you very much for resolving this so quickly!

DylanPiercey commented 3 years ago

Glad to hear, thanks for testing quickly also and of course for reporting the issue 😄

J-Hoh commented 3 years ago

Sorry to reopen this issue @DylanPiercey but I did find another bug (please don't ruin your weekend). Same version problems, working in 7.1.4, bugged in 9.0.2 This time its about the final production webpack built, dev mode works just fine. Sadly I get neither crash nor error message, but it seems like the client side code does not get mounted in browser ? Server side rendering works just fine, and all the code does get shipped to the browser, but not executed.

Still windows 10 environment, however I just tested it, fresh install on a raspberry pi /w ubuntu and I also get no mounting of components, only server side works flawlessly. Haven't tried switching it back to 7.x on there (builds take forever ;') ) but I'd assume it'd work then, like on windows. Between installing a different version and building the webpack project, I deleted /dist/ and /node_modules/.cache/

Dep.versions:

If you need more information / testing, please advise ^^

DylanPiercey commented 3 years ago

@J-Hoh any way you can get a simplified reproduction available and upload to github so I can take a look? I did just get out a release of @marko/compiler and marko which fixes a problem with our new hydration mode, I'd be kinda surprised if it fixes this but might be worth a shot.

J-Hoh commented 3 years ago

Here you go. Might've already found the missing code bit, would submit a pull request but idk where/how you wanna fix that (if that even is the problem)

J-Hoh commented 3 years ago

Alas, even on the raspberry pi / ubuntu; the 9.0.2 just doesnt work for me

sad timez

DylanPiercey commented 3 years ago

@J-Hoh got out another release of Marko, updating to 5.8.3 for marko and @marko/compiler should fix your issue. Looks like this one was not actually windows specific. To give you some context we recently moved a bunch of the "bundler" style logic into the new Marko 5 compiler which drastically simplifies our various plugins. These issues are growing pains around that, and I'm hoping its all resolved now.

Thanks again for taking the time to create the issue and the reproduction. Really helpful! Let me know if there's anything else you run into, but it seems like it's good on my end.

J-Hoh commented 3 years ago

Yep, that seems to fix any bugs I had, site is back to fully working LGTM!