Skip to content

Commit

Permalink
support sass pkg imports
Browse files Browse the repository at this point in the history
  • Loading branch information
delambo committed Jan 22, 2025
1 parent bf2c8ea commit a979917
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
11 changes: 10 additions & 1 deletion packages/kyt-core/src/config/webpack.dev.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware')
const { kytWebpackPlugins } = require('kyt-runtime/webpack');
const { clientSrcPath, assetsBuildPath, publicBuildPath, publicSrcPath } =
require('kyt-utils/paths')();
const { NodePackageImporter } = require('sass');
const getPolyfill = require('./getPolyfill');
const postcssLoader = require('../utils/getPostcssLoader');

Expand Down Expand Up @@ -86,7 +87,15 @@ module.exports = options => {
},
},
postcssLoader,
'sass-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
pkgImporter: new NodePackageImporter(),
},
},
},
],
exclude: [publicSrcPath],
},
Expand Down
11 changes: 10 additions & 1 deletion packages/kyt-core/src/config/webpack.dev.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const { serverSrcPath, serverBuildPath, clientAssetsFile, loadableAssetsFile, publicSrcPath } =
require('kyt-utils/paths')();
const { NodePackageImporter } = require('sass');
const StartServerPlugin = require('./StartServerPlugin');
const postcssLoader = require('../utils/getPostcssLoader');
const getPolyfill = require('./getPolyfill');
Expand Down Expand Up @@ -68,7 +69,15 @@ module.exports = options => {
},
},
postcssLoader,
'sass-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
pkgImporter: new NodePackageImporter(),
},
},
},
],
exclude: [publicSrcPath],
},
Expand Down
4 changes: 4 additions & 0 deletions packages/kyt-core/src/config/webpack.prod.client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Production webpack config for client code
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const { NodePackageImporter } = require('sass');
const { clientSrcPath, assetsBuildPath, publicSrcPath } = require('kyt-utils/paths')();
const { kytWebpackPlugins } = require('kyt-runtime/webpack');
const postcssLoader = require('../utils/getPostcssLoader');
Expand Down Expand Up @@ -44,6 +45,9 @@ module.exports = options => ({
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
pkgImporter: new NodePackageImporter(),
},
},
},
],
Expand Down
11 changes: 10 additions & 1 deletion packages/kyt-core/src/config/webpack.prod.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const { NodePackageImporter } = require('sass');
const { serverSrcPath, serverBuildPath, publicSrcPath } = require('kyt-utils/paths')();
const postcssLoader = require('../utils/getPostcssLoader');
const getPolyfill = require('./getPolyfill');
Expand Down Expand Up @@ -51,7 +52,15 @@ module.exports = options => {
},
},
postcssLoader,
'sass-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
pkgImporter: new NodePackageImporter(),
},
},
},
],
exclude: [publicSrcPath],
},
Expand Down

0 comments on commit a979917

Please sign in to comment.