Ticket T1160598
Visible to All Users

Disable treeshaking for the RichEdit package in Vite-based applications

created 2 years ago (modified 2 years ago)

[DevExpress Support Team: CLONED FROM T1054272: Vue3/React+Vite (Rollup) - DevExtreme fails in production because some modules do not pass treeshaking (no side effects)]

Also, the above solutions seem to be working except for the dxRichEdit component. Is there any alias for that module?

Comments (1)
DevExpress Support Team 2 years ago

    Hi Slaven,

    I need more time to check the issue. I'll inform you once I have any news.

    Answers approved by DevExpress Support

    created 2 years ago (modified 2 years ago)

    Hi Slaven,

    Thank you for your patience. The issue occurs because of the way Vite processes CommonJS modules from the devexpress-richedit package. In this case, it is necessary to make a change to the vite.config.js file to resolve the issue. Please try the following configuration:

    JavaScript
    export default defineConfig({ plugins: [vue(), vueJsx()], resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)), "devextreme/ui": "devextreme/esm/ui", }, }, optimizeDeps: { force: true, //to make sure that the cache is updated disabled: false, }, build: { commonjsOptions: { include: [], }, }, });

    Let me know if this solution works for you.

    Updated:

    We switched to ES6 modules in v23.1. So, it won't be necessary to use the workaround after we release v23.1.

      Comments (3)
      DevExpress Support Team 2 years ago

        A follow-up comment.

        I also want to note that we switched to ES6 modules in v23.1. So, it won't be necessary to use the workaround from the Answer after we release v23.1. You can check how this works by upgrading a test project using the following command:

        JavaScript
        npm i devexpress-richedit@23.1.2-alpha-23079-0101 devextreme@23.1.2-alpha-23076-1933 devextreme-vue@23.1.2-alpha-23076-1933

          Glad to hear that. I'll be waiting for the 23.1 version of devextreme until I start using Vite. Thank you!

          DevExpress Support Team 2 years ago

            You are always welcome, Slaven! Have a great day!

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.