-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: optimize
@farmfe/core
api logic (#1375)
* chore: update code package logic * chore: update demo * chore: update templates * chore: update code * chore: update logic * chore: update logic * chore: update test * chore: bump version * chore: update code * chore: update templates * chore: remove unless code * chore: Simplify the rules for using api * chore: Compatible with previous versions of watcher
- Loading branch information
Showing
17 changed files
with
191 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@farmfe/core": minor | ||
--- | ||
|
||
optimize @farmfe/core api usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
createCompiler, | ||
createDevServer, | ||
createFileWatcher, | ||
resolveConfig, | ||
start, | ||
} from "@farmfe/core"; | ||
|
||
const resolvedUserConfig = await resolveConfig({ | ||
compilation: { | ||
sourcemap: true, | ||
persistentCache: false, | ||
presetEnv: false, | ||
progress: false, | ||
output: { | ||
publicPath: '/dist/' | ||
}, | ||
input: { | ||
index: './index.html' | ||
} | ||
}, | ||
server: { | ||
port: 6532, | ||
hmr: { | ||
path: '/__farm_hmr' | ||
} | ||
}, | ||
plugins: [ | ||
'@farmfe/plugin-react', | ||
'@farmfe/plugin-sass' | ||
], | ||
mode: 'development', | ||
}); | ||
|
||
const compiler = await createCompiler(resolvedUserConfig); | ||
|
||
const devServer = await createDevServer(compiler, resolvedUserConfig); | ||
|
||
await devServer.listen(); | ||
|
||
await start({ | ||
compilation: { | ||
sourcemap: true, | ||
persistentCache: false, | ||
presetEnv: false, | ||
progress: false, | ||
output: { | ||
publicPath: '/dist/' | ||
}, | ||
input: { | ||
index: './index.html' | ||
} | ||
}, | ||
server: { | ||
port: 6532, | ||
hmr: { | ||
path: '/__farm_hmr' | ||
} | ||
}, | ||
plugins: [ | ||
'@farmfe/plugin-react', | ||
'@farmfe/plugin-sass' | ||
], | ||
mode: 'development', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.