next.js icon indicating copy to clipboard operation
next.js copied to clipboard

exporting dynamic routes with sass

Open ercekal opened this issue 7 years ago • 2 comments

I want to export 3 dynamic routes with sass support however when I run yarn build & yarn export I only receive one index page. I actually need one index.html page along with 3 folder snd their related index.html pages. Is there a proper way to merge exportPathMap and withSass ?

const path = require('path');

module.exports = withSass({
  async exportPathMap() {
    // need to find a solution for this... it's a hacky way
    const list = ['slate-bullet', 'bullet_new_navy', 'olive-bullet'];
    const pages = list.reduce(
      (pages, item) =>
        Object.assign({}, pages, {
          [`/products/${item}`]: {
            page: '/products',
            query: { productHandle: item }
          }
        }),
      {}
    );
    return Object.assign({}, pages, {
      '/products': { page: '/products' }
    });
  }
});

module.exports = {
  webpack: (config, { defaultLoaders }) => {
    config.resolve.alias['styles'] = path.join(__dirname, 'styles')
    config.module.rules.push({
      test: /\.scss$/,
      use: [
        defaultLoaders.babel,
        {
          loader: require('styled-jsx/webpack').loader,
          options: {
            type: 'scoped'
          }
        },
        {
          loader: 'sass-loader',
          options: {
            sourceMap: true
          }
        },
        {
          loader: 'sass-resources-loader',
          options: {
            resources: [
              './styles/core/helpers/*.scss',
              './styles/core/type/*.scss',
              './styles/core/grid/_grid.scss'
            ]
          }
        }
      ]
    });

    return config;
  }
};

Question about Next.js

GitHub Issues are reserved for Bug reports and Feature requests. The best place to get your question answered is to post it on https://spectrum.chat/next-js.

ercekal avatar May 22 '19 11:05 ercekal

Closing in favor of the spectrum thread

ijjk avatar May 22 '19 15:05 ijjk

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

balazsorban44 avatar Jan 31 '22 14:01 balazsorban44