diff --git a/packages/emp-cli/helpers/paths.js b/packages/emp-cli/helpers/paths.js index bbbb87e2..0372453c 100644 --- a/packages/emp-cli/helpers/paths.js +++ b/packages/emp-cli/helpers/paths.js @@ -7,6 +7,7 @@ const resolveApp = relativePath => path.resolve(appDirectory, relativePath) // console.log('__dirname===>', __dirname, path.join(__dirname, '../template/public/favicon.ico')) let paths = {} const setPaths = ({src, dist, public}) => { + const appRoot = appDirectory const appSrc = src ? resolveApp(src) : resolveApp('src') const entry = src ? resolveApp(src) : resolveApp('src/index.ts') const appPackageJson = resolveApp('package.json') @@ -18,7 +19,7 @@ const setPaths = ({src, dist, public}) => { favicon = fs.existsSync(favicon) ? favicon : path.join(__dirname, '../template/public/favicon.ico') template = fs.existsSync(template) ? template : path.join(__dirname, '../template/public/index.html') appPath = resolveApp('.') - paths = {appSrc, appPath, appPackageJson, entry, dist, public, favicon, template} + paths = {appRoot, appSrc, appPath, appPackageJson, entry, dist, public, favicon, template} } const getPaths = () => paths module.exports = { diff --git a/packages/emp-cli/package.json b/packages/emp-cli/package.json index cd2b95ed..f4d6a08b 100644 --- a/packages/emp-cli/package.json +++ b/packages/emp-cli/package.json @@ -1,6 +1,6 @@ { "name": "@efox/emp-cli", - "version": "1.2.5", + "version": "1.2.6", "keywords": [ "react", "module federation", diff --git a/packages/emp-cli/webpack/config/devServer.js b/packages/emp-cli/webpack/config/devServer.js index e41c7e7d..20c8bdb8 100644 --- a/packages/emp-cli/webpack/config/devServer.js +++ b/packages/emp-cli/webpack/config/devServer.js @@ -14,6 +14,7 @@ module.exports = (env, {hot, open, progress}) => { historyApiFallback: true, // open: open === true, hot: hot === true, + overlay: !hot, progress: progress === true, stats: { colors: true, diff --git a/packages/emp-cli/webpack/config/plugin.js b/packages/emp-cli/webpack/config/plugin.js index 3c4c64a8..514254d3 100644 --- a/packages/emp-cli/webpack/config/plugin.js +++ b/packages/emp-cli/webpack/config/plugin.js @@ -97,9 +97,9 @@ module.exports = (env, config, {analyze, empEnv, ts, progress, createName, creat extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'], formatter: require.resolve('react-dev-utils/eslintFormatter'), eslintPath: require.resolve('eslint'), - context: path.appSrc, - cache: true, - cwd: path.appPath, + context: paths.appSrc, + cache: false, + cwd: paths.appRoot, resolvePluginsRelativeTo: __dirname, }, ], diff --git a/projects/empty-project/package.json b/projects/empty-project/package.json index f09a5fe6..1cf75ae2 100644 --- a/projects/empty-project/package.json +++ b/projects/empty-project/package.json @@ -5,6 +5,7 @@ "license": "MIT", "dependencies": { "axios": "^0.20.0", + "html-webpack-plugin": "^5.0.0-alpha.10", "husky": "^4.2.5", "lint-staged": "^10.2.7", "postcss-px-to-viewport": "^1.1.1", diff --git a/projects/empty-project/src/App.tsx b/projects/empty-project/src/App.tsx index 1e1ae72d..01f26fc3 100644 --- a/projects/empty-project/src/App.tsx +++ b/projects/empty-project/src/App.tsx @@ -20,15 +20,15 @@ class Democlass { } new Democlass() export default function App() { - const a = 1 + /* const a = 1 if (a === true) { console.log(1) - } + } */ return ( <> -

EMP EMPTY PROJECT DEMO

+

EMP EMPTY PROJECT DEMO!

Infomation!!!

config:{JSON.stringify(config)}

diff --git a/projects/empty-project/src/Hello.tsx b/projects/empty-project/src/Hello.tsx index a0a6a244..99718e7d 100644 --- a/projects/empty-project/src/Hello.tsx +++ b/projects/empty-project/src/Hello.tsx @@ -6,8 +6,8 @@ const HttpDemo = () => { const [l, setL] = useState({}) useEffect(() => { ;(async () => { - const lang = await axios.get('https://api.github.com/users') - setL(lang.data[0]) + // const lang = await axios.get('https://api.github.com/users') + // setL(lang.data[0]) })() }, []) return

http:{JSON.stringify(l)}

diff --git a/yarn.lock b/yarn.lock index 4c838924..81a126c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6100,6 +6100,19 @@ html-minifier-terser@^5.0.1: relateurl "^0.2.7" terser "^4.6.3" +html-webpack-plugin@^5.0.0-alpha.10: + version "5.0.0-alpha.10" + resolved "https://registry.npm.taobao.org/html-webpack-plugin/download/html-webpack-plugin-5.0.0-alpha.10.tgz?cache=0&sync_timestamp=1604303597686&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhtml-webpack-plugin%2Fdownload%2Fhtml-webpack-plugin-5.0.0-alpha.10.tgz#edc754eb32240c4a54b82b4d0a1df1bfa045b27c" + integrity sha1-7cdU6zIkDEpUuCtNCh3xv6BFsnw= + dependencies: + "@types/html-minifier-terser" "^5.0.0" + "@types/tapable" "^1.0.5" + html-minifier-terser "^5.0.1" + loader-utils "2.0.0" + lodash "^4.17.20" + pretty-error "^2.1.1" + tapable "2.0.0" + html-webpack-plugin@^5.0.0-alpha.9: version "5.0.0-alpha.9" resolved "https://registry.npm.taobao.org/html-webpack-plugin/download/html-webpack-plugin-5.0.0-alpha.9.tgz#6d04b3be2186756530730e1fb160b04aa0e32383"