Skip to content

Commit

Permalink
Merge pull request #40 from aleleba/PR-665639
Browse files Browse the repository at this point in the history
PR-665639: Update webpack.config.ts, webpack.cy.config.ts, .storybook/main.js, and package.json to add support to sass modules.
  • Loading branch information
aleleba authored Nov 22, 2023
2 parents 7e1457c + b1c9a66 commit 2fbcca0
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 46 deletions.
16 changes: 15 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@ const deFaultValues = {
const prefixUrl = process.env.PREFIX_URL ? process.env.PREFIX_URL : deFaultValues.PREFIX_URL
module.exports = {
"stories": ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
"addons": ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions", "@storybook/preset-scss"],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
{
name: '@storybook/preset-scss',
options: {
cssLoaderOptions: {
modules: {
auto: /\.module\.\w+$/i,
}
}
}
}
],
"webpackFinal": async config => {
config.entry = config.entry.map(function(entry) {
if (entry.includes("webpack-hot-middleware")) {
Expand Down
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aleleba/create-react-component-library",
"version": "1.2.17",
"version": "1.2.18",
"description": "A starter kit for create a React component Library with storybook",
"bin": "./bin/cli.js",
"main": "dist/index.js",
Expand Down Expand Up @@ -55,16 +55,16 @@
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.2",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/jest": "^29.5.10",
"@types/node": "^20.9.4",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"@types/webpack": "^5.28.5",
"babel-loader": "^9.1.3",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"cypress": "^13.5.1",
"cypress": "^13.6.0",
"dotenv": "^16.3.1",
"eslint": "^8.54.0",
"eslint-plugin-react": "^7.33.2",
Expand Down
9 changes: 8 additions & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ export default {
test: /\.(css|sass|scss)$/,
use: [
externalCss === true ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader',
{
'loader': 'css-loader',
'options': {
modules: {
auto: /\.module\.\w+$/i,
}
},
},
'sass-loader',
],
},
Expand Down
9 changes: 8 additions & 1 deletion webpack.cy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ export default {
test: /\.(css|sass|scss)$/,
use: [
externalCss === true ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader',
{
'loader': 'css-loader',
'options': {
modules: {
auto: /\.module\.\w+$/i,
}
},
},
'sass-loader',
],
},
Expand Down

0 comments on commit 2fbcca0

Please sign in to comment.