Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

Cannot polymer serve / test working on a mono-repo project #2607

Open eavichay opened 6 years ago

eavichay commented 6 years ago

Description

I have a mono-repo project, with two polymer-based projects (one is library, the other is the main project) The folder structure:

-<ROOT>
|-- node_modules (shared by yarn-workspaces + lerna)
\-- packages
     |-- MyLib
     \-- MyProject (polymer-based)

All the node_modules are in the shared node_modules folder, collected by yarn workspaces monorepo approach.

The polymer server cannot find node_modules in the project's directory and probably should fall back just like node does to an upper directory, until found? This cannot be resolved using specific import paths as the "root" server folder is in the package folder and cannot go to an upper directory.

Versions & Environment

Steps to Reproduce

yarn workspaces + monorepo project under packages two projects using same @polymer/polymer@3+ version

run polymer serve or polymer test in any of them - server fails to locate the node_modules.

Expected Results

polymer server to traverse up until node_modules with the library is found

Actual Results

404 Not Found

sebaranowski commented 5 years ago

https://github.com/Polymer/tools/issues/273 https://github.com/lerna/lerna/issues/1561

btopro commented 5 years ago

use nohoist to get everything into the local directory when needed. In local dev toss this in a script tag b4 the type modules

const _customElementsDefine = window.customElements.define;
window.customElements.define = (name, cl, conf) => {
  if (!customElements.get(name)) {
    _customElementsDefine.call(window.customElements, name, cl, conf);
  }
  else {
    console.warn(`${name} has been defined twice`);
  }
};
eavichay commented 5 years ago

project package.json points the library to local filesystem, no install or download via npm resgistry. Will the polymer server add something like modules-middleware in order to solve this?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.