Giter Club home page Giter Club logo

Comments (2)

padarom avatar padarom commented on August 24, 2024

Possibly related to vitejs/vite#1579.

The compiled UMD module is

(function(global, factory) {
  typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory(require("@awtrix/common"), require("vue")) : typeof define === "function" && define.amd ? define(["@awtrix/common", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.AwtrixComponent = global.AwtrixComponent || {}, global.AwtrixComponent["example@0-1-0"] = factory(global.AwtrixCommon, global.Vue));
})(this, function(common, vue) {
  "use strict";
  var _sfc_main = common.defineComponent({
    mounted() {
      this.lock();
    }
  });
  var frontend_vue_vue_type_style_index_0_scoped_true_lang = "\n#app[data-v-32dd3081] {\n  background: red;\n}\n";
  const _withId = /* @__PURE__ */ vue.withScopeId("data-v-32dd3081");
  vue.pushScopeId("data-v-32dd3081");
  const _hoisted_1 = {id: "app"};
  vue.popScopeId();
  const _sfc_render = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => {
    return vue.openBlock(), vue.createBlock("div", _hoisted_1, vue.toDisplayString(_ctx.app.name) + "@" + vue.toDisplayString(_ctx.app.version), 1);
  });
  _sfc_main.render = _sfc_render;
  _sfc_main.__scopeId = "data-v-32dd3081";
  return _sfc_main;
});

The variable frontend_vue_vue_type_style_index_0_scoped_true_lang which contains the style isn't used anywhere. Might need to write a custom Vite plugin to make use of this.

from hd.

padarom avatar padarom commented on August 24, 2024

After tons of trying to figure out how Vite/rollup compiles the UMD module and not getting a result I figured out that rollup indeed just compiles a separate style.css file. Therefore I just included this style in a link tag when rendering the component, which now works.

Tested with multiple <style> tags within the frontend.vue, with scoped styles and with lang="stylus".

See 1cf81bf

from hd.

Related Issues (12)

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.