Code Monkey home page Code Monkey logo

Comments (6)

deepsweet avatar deepsweet commented on June 17, 2024

what exactly do you mean by "merged" layer?

from layers-loader.

Guria avatar Guria commented on June 17, 2024

for given example it would like:

.
└── merged-layer/
    └── button/
        └── core-components.js   // export default class
        └── custom-components.js // import Button from './core-components'; export default class
        └── product-theme.js     // import Button from './custom-components'; export default class
        └── index.js             // export Button as default from './product-theme';
        └── index.css            // styles from theme-reset/button/styles.less and product-theme/button/styles.less

from layers-loader.

Guria avatar Guria commented on June 17, 2024

app

.
└── app/
    └── somewhere.js
import Button from 'merged-layer/button';
import 'merged-layer/button/index.css';

class SomeAppComponent extends React.Component {
    // ...
    return (
      //...
        <Button
          icon="never-gonna-give-you-up.png"
          onClick={doStuff}>
          {'Click me'}
        </Button>
      //...
    );
}

from layers-loader.

deepsweet avatar deepsweet commented on June 17, 2024

I'm not quite sure that it's possible at all. I mean you can't prebuild your layer standalone because you don't know about other layers.

@mistadikay

from layers-loader.

mistadikay avatar mistadikay commented on June 17, 2024

I think @Guria means prebuilding layer with resolved #-imports, so you can just require, for example, button — and it will be already prebuilded with all layers. Maybe it's possible to prebuild layer with a separate entry point for each component? But what about other dependencies, for example, if some component uses moment library — should it be bundled as well in this case?

from layers-loader.

Guria avatar Guria commented on June 17, 2024

@mistadikay yep, you are right. It should be some build tool which use layer array ([require('core-components'),require('theme-reset'),require('../custom-layer')]) as input and generates merged layer by resolving #-imports.

But what about other dependencies, for example, if some component uses moment library — should it be bundled as well in this case?

Of course not. Usual requires should left as is. Hmm. It means we should somehow merge dependencies from layers too.

from layers-loader.

Related Issues (3)

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.