What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hey, does anyone have an example extended ZED Config for the webpack build? We're running into the i

UKK4YJ2AU
UKK4YJ2AU Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

Hey, does anyone have an example extended ZED Config for the webpack build? We're running into the issue of dependencies not being found, even tho all entries are there.

Comments

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited January 2022

    backend/build.json

    const oryx = require('@spryker/oryx');
    const oryxForZed = require('@spryker/oryx-for-zed');
    const { join } = require('path');
    const customContext = process.cwd();
    const projectPath = '/src/';
    // deprecated copyAssetsCallback for backward compatibility only
    const copyAssetsCallback = require('@spryker/oryx-for-zed/lib/copy');
    
    const myCustomZedSettings = Object.assign({}, oryxForZed.settings, {
        ...oryxForZed.settings,
        entry: {
            ...oryxForZed.settings.entry,
            dirs: [...oryxForZed.settings.entry.dirs, join(customContext, projectPath)],
        },
    });
    oryxForZed
        .getConfiguration(myCustomZedSettings)
        .then((configuration) => oryx.build(configuration, copyAssetsCallback))
        .catch((error) => console.error('An error occurred while creating configuration', error)); 
    
  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    then in package.json just point to your custom build.json
    i.e.

    "zed": "node ./backend/build",
    
  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    or do u mean something else?

  • UKK4YJ2AU
    UKK4YJ2AU Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited January 2022

    I'm just asking since we're getting errors from commons.js in regards to missing dependencies/modules

  • UKK4YJ2AU
    UKK4YJ2AU Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    For example:

    ERROR in ./vendor/spryker/gui/assets/Zed/js/modules/commons.js
    Module not found: Error: Can't resolve 'sweetalert' in '/data/vendor/spryker/gui/assets/Zed/js/modules'
     @ ./vendor/spryker/gui/assets/Zed/js/modules/commons.js 65:0-21
     @ ./vendor/spryker/gui/assets/Zed/js/spryker-zed-gui-commons.entry.js
    
  • UKK4YJ2AU
    UKK4YJ2AU Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UL65CH0MC did you encounter this issue by any chance as well?

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    i don't remember... did u run project install dependencies and zed project install dependencies command before?

    vendor/bin/console frontend:project:install-dependencies
    vendor/bin/console frontend:zed:install-dependencies
    
  • UKK4YJ2AU
    UKK4YJ2AU Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yes, all dependencies are installed and the error is only showing up when using a modified build for zed

  • UKK4YJ2AU
    UKK4YJ2AU Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    With default build there are no issues

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    can u show me your frontend-build-config.json?

  • UKK4YJ2AU
    UKK4YJ2AU Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    Initially our plan was to extend the zed config as shown in the article inside the documentation - https://docs.spryker.com/docs/scos/dev/front-end-development/zed/overriding-webpack-js-scss-for-zed-on-project-level.html

    There we get no issues during the build process, but rather get issues with the actual frontend and missing modules from commons.js

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    The overriding ist just what i sent u yesterday... but with so few details I can't figure out what/where is the problem...