marko-js / webpack

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

Breaks if component filename contains `?` #49

Open taylor-hunt-kr opened 3 years ago

taylor-hunt-kr commented 3 years ago

I was using a filesystem-based router that supports querystring parameters.

If I had to guess, the ? in the filename conflicts with Webpack’s old-fashioned loader syntax.

Steps to Reproduce

  1. Name a .marko file with ? somewhere in it. I had ?search.marko.
  2. Attempt to bundle it — I was using it as a route entry point, so it was imported from a .js file.
  3. Behold:

    ERROR in ./routes/_router.js 19:0-36
    Module not found: Error: Can't resolve './?search.marko?assets' in '~/repo/routes'
    @ ./index.js 4:0-40 24:11-24

And if you think ?param.marko is goofy…

The Marko compiler gets confused if the standard directory/index.ext convention is used, since it supports component-name/index.marko. As a result, this router instead has the convention of directory/.marko.

You might be pleasantly surprised to learn that works.