Giter VIP home page Giter VIP logo

Comments (1)

hutchgrant avatar hutchgrant commented on June 3, 2024 1

There's a major problem with doing this that we need to tackle.

An app(or page)-template.js could(probably will) include additional components, such as a header, footer, sidebar, who knows. When they import those components, lets say we force them to use a standard folder, for example src/components okay all the components go in there. Fine.

But... when we build, it needs to copy those files over to the scratchDirectory. This is where the problem begins.

so my user example project could be

├── src
│   ├── components
│   │   └── index.js
│   ├── pages
│   │   └── hello.md
│   └── templates
│       ├── app-template.js
│       └── page-template.js

so the app-template.js if it wants to include the components, it needs to:

import '../component/index.js`

No problem right?

Well, the problem is when this app-template turns into a app.js file within the .greenwood scratch directory, no components folder exists and if we create it, it still won't be the correct path for the relative import above.

import './components/index.js`

works, but that's so anti-practise.

edit: actually came up with a small solution. the app.js file must be placed in any directory so that the relative import paths (whatever they are) at least are correct. So I'm putting the app.js into a .greenwood/app/app.js directory and modifying webpack entry point. I'll also put the list.js (which is also broken by this path change) in that app directory as well by default.

from greenwood.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.