Shopify / slate

Slate is a toolkit for developing Shopify themes. It's designed to assist your workflow and speed up the process of developing, testing, and deploying themes.
https://shopify.github.io/slate
MIT License
1.28k stars 364 forks source link

How to declare additional Webpack Entry Points #986

Closed lmartins closed 5 years ago

lmartins commented 5 years ago

Problem

I'm trying to understand how could I extend Slate configuration to declare additional Webpack entry points, however when I try adding a entry object to slate.config.js I get an error reporting multiple entry points being declared to the same name.

module.exports = {
  slateCssVarLoader: {
    cssVarLoaderLiquidPath: ['src/snippets/css-variables.liquid']
  },
  slateTools: {
    extends: {
      dev: {
        entry: {
           `redirect:` './assets/scripts/redirect.js'
        },
        resolve: { extensions, alias },
        module: {
          rules: [
            {
              test: /\.jsx/,
              loader: 'babel-loader'
            }
          ]
        }
      }
  }
};

I assume there will be a specific syntax for the use case, can you confirm what would that be?

The use case here is that I to have a script run very early on a specific page, where waiting for the main bundle to load is a little too late.

Is there a way to achieve this while retaining Slate abilities?

t-kelly commented 5 years ago

Hey @lmartins -- will need you to be using the latest version of Slate for me to help. The structure and options available in slate.config.js have changed from the example you have pasted.

lmartins commented 5 years ago

@t-kelly understandable. I will try figure out a different approach then, as updating this project at this time is not feasible given the changes in the assets directory/processing, etc.

Thank you for looking into this though.

dan-gamble commented 5 years ago

Hey @lmartins,

I've successfully upgraded quite large stores from as low as beta 0.1 to 0.14 if you'd like some advice on how to do this. We've also added PostCSS in to our stack over Sass so it is slightly more complex than it should be as well.

lmartins commented 5 years ago

Thank you @dan-gamble, that is awesome! I've done a few upgrades too, I'm avoiding doing it in this case due to the changes with SVG assets, which I'm using extensively on this project. I will eventually move things on this project too.

Thanks again for being available.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.