diff --git a/.env.example b/.env.example index 15aa969..58d7c1a 100644 --- a/.env.example +++ b/.env.example @@ -3,4 +3,6 @@ LIBRARY_NAME= #External CSS (Default: false) EXTERNAL_CSS= #External CSS NAME (Default: index.css) -EXTERNAL_CSS_NAME= \ No newline at end of file +EXTERNAL_CSS_NAME= +#PREFIX URL (Default: '') +PREFIX_URL= \ No newline at end of file diff --git a/.storybook/main.js b/.storybook/main.js index 92cde1f..b69c0cd 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,9 +1,19 @@ const path = require('path'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); +const deFaultValues = { + PREFIX_URL: '' +} +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"], "webpackFinal": async config => { + config.entry = config.entry.map(function(entry) { + if (entry.includes("webpack-hot-middleware")) { + return `${require.resolve('webpack-hot-middleware/client')}?path=${prefixUrl}__webpack_hmr&reload=true`; + } + return entry; + }), config.resolve.alias = { ...config.resolve.alias, '@components': path.resolve(__dirname, "../src/components/") diff --git a/package-lock.json b/package-lock.json index 6c4f5a5..65f0393 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aleleba/create-react-component-library", - "version": "1.2.10", + "version": "1.2.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aleleba/create-react-component-library", - "version": "1.2.10", + "version": "1.2.11", "license": "MIT", "bin": { "create-react-component-library": "bin/cli.js" diff --git a/package.json b/package.json index f31edff..a0c74b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aleleba/create-react-component-library", - "version": "1.2.10", + "version": "1.2.11", "description": "A starter kit for create a React component Library with storybook", "bin": "./bin/cli.js", "main": "dist/index.js",