preactjs/wmr

npm registry lookup failed for "@npm/object-assign": Package doesn't exist.

Aloento opened this issue · 3 comments

Describe the bug
After compiling, at the top of @npm/prop-types, there're

import require$$0 from '/@npm/react-is'; // sometime is wrong with "./@npm/react-is"
import require$$1 from './@npm/object-assign';

the original prop-types.js file is:

var ReactIs = require('react-is');
var assign = require('object-assign');

Then, './@npm/object-assign' is /@npm/@npm/object-assign, which is incorrect path.

object-assign required by prop-types required by react-helmet-async

To Reproduce
yarn create wmr & yarn add react-helmet-async

index.js

export function App() {
  return (
    <LocationProvider>
+      <HelmetProvider>
        <div class="app">
          <Header />
          <ErrorBoundary>
            <Router>
              <Route path="/" component={Home} />
              <Route path="/about" component={About} />
              <Route default component={NotFound} />
            </Router>
          </ErrorBoundary>
        </div>
+      </HelmetProvider>
    </LocationProvider>
  );
}

Does anybody know how to fix this path?

WMR doesn't have great support of pure CJS dependencies, which does limit some of the React ecosystem.

We use hoofd in the docs for this repo, which I can recommend in its place, but it is a different API.

Yes - just to clarify, WMR has some CommonJS support, but packages published by the React team use a complex CommonJS setup that is very difficult (and in some cases impossible) to handle on-the-fly.

I'm going to dedupe this with #903 (thanks for pointing to that issue @Aloento!)