feat: use commonsChunk build common lib

This commit is contained in:
suxiaoxin 2017-07-27 21:38:30 +08:00
parent 20e35f15de
commit 369a711352
5 changed files with 62 additions and 4 deletions

View File

@ -5,15 +5,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>my yApi</title> <title>my yApi</title>
<link rel="stylesheet" href="http://127.0.0.1:4000/yapi/prd/index@dev.css"> <link rel="stylesheet" href="http://127.0.0.1:4000/yapi/prd/index@dev.css">
<script src="https://qsso.corp.qunar.com/lib/qsso-auth.js"></script>
</head> </head>
<body> <body>
<div id="yapi" style="height: 100%;"></div> <div id="yapi" style="height: 100%;"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.8/ace.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.8/mode-json.js"></script>
<script src="http://127.0.0.1:4000/yapi/prd/manifest@dev.js"></script>
<script src="http://127.0.0.1:4000/yapi/prd/lib2@dev.js"></script>
<script src="http://127.0.0.1:4000/yapi/prd/lib@dev.js"></script>
<script src="http://127.0.0.1:4000/yapi/prd/index@dev.js"></script> <script src="http://127.0.0.1:4000/yapi/prd/index@dev.js"></script>
<script src="/lib/ace-1.2.8.js"></script>
<script src="/lib/mode-json-1.2.8.js"></script>
<script src="https://qsso.corp.qunar.com/lib/qsso-auth.js"></script>
</body> </body>

View File

@ -6,17 +6,37 @@
<title>my yApi</title> <title>my yApi</title>
<script> <script>
document.write('<script src="prd/assets.js?v=' + Math.random() + '"><\/script>'); document.write('<script src="prd/assets.js?v=' + Math.random() + '"><\/script>');
console.log(window)
</script> </script>
<script> <script>
document.write('<link rel="stylesheet" href="/prd/' + window.WEBPACK_ASSETS['index.js'].css + '" />'); document.write('<link rel="stylesheet" href="/prd/' + window.WEBPACK_ASSETS['index.js'].css + '" />');
</script> </script>
<script src="https://qsso.corp.qunar.com/lib/qsso-auth.js"></script>
</head> </head>
<body> <body>
<div id="yapi" style="height: 100%;"></div> <div id="yapi" style="height: 100%;"></div>
<script>
document.write('<script src="/prd/' + window.WEBPACK_ASSETS['manifest'].js + '"><\/script>');
</script>
<script>
document.write('<script src="/prd/' + window.WEBPACK_ASSETS['lib2'].js + '"><\/script>');
</script>
<script>
document.write('<script src="/prd/' + window.WEBPACK_ASSETS['lib'].js + '"><\/script>');
</script>
<script> <script>
document.write('<script src="/prd/' + window.WEBPACK_ASSETS['index.js'].js + '"><\/script>'); document.write('<script src="/prd/' + window.WEBPACK_ASSETS['index.js'].js + '"><\/script>');
</script> </script>
<script src="/lib/ace-1.2.8.js"></script>
<script src="/lib/mode-json-1.2.8.js"></script>
<script src="https://qsso.corp.qunar.com/lib/qsso-auth.js"></script>
</body> </body>
</html> </html>

14
static/lib/ace-1.2.8.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

17
ykit.js
View File

@ -22,6 +22,23 @@ module.exports = {
exports: [ exports: [
'./index.js' './index.js'
], ],
commonsChunk: {
//filename: 'scripts/[name]@[chunkhash][ext]',
vendors: {
lib: ['react', 'redux',
'redux-thunk',
'react-dom',
'redux-promise',
'react-router-dom',
'prop-types',
'axios',
'moment'
],
lib2: [
'antd'
]
}
},
modifyWebpackConfig: function (baseConfig) { modifyWebpackConfig: function (baseConfig) {
baseConfig.devtool = 'cheap-module-eval-source-map' baseConfig.devtool = 'cheap-module-eval-source-map'