Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/efoxTeam/emp into main
Browse files Browse the repository at this point in the history
  • Loading branch information
flyyuan committed Nov 4, 2020
2 parents 1adca6f + 1079432 commit 956fd2b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 10 deletions.
3 changes: 2 additions & 1 deletion packages/emp-cli/helpers/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion packages/emp-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@efox/emp-cli",
"version": "1.2.5",
"version": "1.2.6",
"keywords": [
"react",
"module federation",
Expand Down
1 change: 1 addition & 0 deletions packages/emp-cli/webpack/config/devServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions packages/emp-cli/webpack/config/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
Expand Down
1 change: 1 addition & 0 deletions projects/empty-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions projects/empty-project/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<Logo width="350" className={css['App-logo']} />
<img src={require('src/assets/mf.png')} width="300" />
<h1 className={css.main}>EMP EMPTY PROJECT DEMO</h1>
<h1 className={css.main}>EMP EMPTY PROJECT DEMO!</h1>
<p>Infomation!!!</p>
<p>config:{JSON.stringify(config)}</p>
<Hello />
Expand Down
4 changes: 2 additions & 2 deletions projects/empty-project/src/Hello.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <p>http:{JSON.stringify(l)}</p>
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 956fd2b

Please sign in to comment.