Skip to content

Commit a99ba31

Browse files
author
谢明
committed
feat: webpackChunkName
增加webpackChunkName的描述,打包以后的模块会有名称
1 parent 63f42ee commit a99ba31

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

config/webpack.config.common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ module.exports = {
104104
new webpack.EnvironmentPlugin(['NODE_ENV'])
105105
],
106106
resolve: {
107-
modules: [resolve(__dirname, '../src/'), 'node_modules']
107+
modules: [resolve(__dirname, '../src/'), 'node_modules'],
108+
extensions: [ '.js', '.scss', '.less' ]
108109
},
109110
optimization: {
110111
splitChunks: {

src/containers/AppLayout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import NotFound from '../containers/NotFound';
55
import NavBar from '../components/NavBar';
66

77
const Home = Loadable({
8-
loader: () => import('../components/CssModule'),
8+
loader: () => import('../components/CssModule' /* webpackChunkName: 'Home' */),
99
loading: () => <p>加载中...</p>
1010
});
1111

1212
const Article = Loadable({
13-
loader: () => import('../components/Article'),
13+
loader: () => import('../components/Article' /* webpackChunkName: 'Article' */),
1414
loading: () => <p>加载中...</p>
1515
});
1616

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8937,6 +8937,10 @@ webpack-addons@^1.1.5:
89378937
dependencies:
89388938
jscodeshift "^0.4.0"
89398939

8940+
webpack-async-chunk-names-plugin@^0.1.1:
8941+
version "0.1.1"
8942+
resolved "https://registry.yarnpkg.com/webpack-async-chunk-names-plugin/-/webpack-async-chunk-names-plugin-0.1.1.tgz#ebb8deda59887603331ff2cabbaee5b853fe0bb5"
8943+
89408944
89418945
version "2.1.3"
89428946
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-2.1.3.tgz#65d166851abaa56067ef3f716b02a97ba6bbe84d"

0 commit comments

Comments
 (0)