Skip to content

Commit 64e710b

Browse files
committed
解决无法分开打包的bug
1 parent 3ea258b commit 64e710b

File tree

5 files changed

+149
-153
lines changed

5 files changed

+149
-153
lines changed

.babelrc

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"presets": [
3-
["env", {
4-
"modules": false,
5-
"targets": {
6-
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7-
}
8-
}],
9-
"stage-2"
10-
],
11-
"plugins": ["transform-runtime"],
12-
"env": {
13-
"test": {
14-
"presets": ["env", "stage-2"],
15-
"plugins": ["istanbul"]
2+
"presets": [
3+
["env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7+
}
8+
}],
9+
"stage-2"
10+
],
11+
"plugins": ["syntax-dynamic-import"],
12+
"env": {
13+
"test": {
14+
"presets": ["env", "stage-2"],
15+
"plugins": ["istanbul"]
16+
}
1617
}
17-
}
18-
}
18+
}

package.json

+127-125
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,128 @@
11
{
2-
"name": "vue-demo",
3-
"version": "1.0.0",
4-
"description": "A Vue.js project",
5-
"author": "yangd <[email protected]>",
6-
"private": true,
7-
"scripts": {
8-
"dev": "node build/dev-server.js",
9-
"start": "npm run dev",
10-
"build": "node build/build.js",
11-
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
12-
"e2e": "node test/e2e/runner.js",
13-
"test": "npm run unit && npm run e2e",
14-
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
15-
},
16-
"dependencies": {
17-
"axios": "^0.16.2",
18-
"clipboard": "^1.7.1",
19-
"dexie": "^2.0.1",
20-
"echarts": "^3.7.2",
21-
"iview": "^2.5.1",
22-
"less": "^3.0.0-alpha.3",
23-
"less-loader": "^4.0.5",
24-
"node-sass": "^4.5.3",
25-
"normalize.css": "^7.0.0",
26-
"sass-loader": "^6.0.6",
27-
"ts-loader": "^3.0.5",
28-
"tslib": "^1.8.0",
29-
"typescript": "^2.5.3",
30-
"vue": "^2.5.2",
31-
"vue-class-component": "^6.0.0",
32-
"vue-router": "^3.0.1"
33-
},
34-
"devDependencies": {
35-
"@types/jasmine": "^2.6.0",
36-
"@types/webpack": "^3.0.13",
37-
"@types/webpack-env": "^1.13.2",
38-
"autoprefixer": "^7.1.2",
39-
"awesome-typescript-loader": "^3.2.3",
40-
"babel-core": "^6.22.1",
41-
"babel-eslint": "^7.1.1",
42-
"babel-loader": "^7.1.1",
43-
"babel-plugin-istanbul": "^4.1.1",
44-
"babel-plugin-transform-runtime": "^6.22.0",
45-
"babel-preset-env": "^1.3.2",
46-
"babel-preset-stage-2": "^6.22.0",
47-
"babel-register": "^6.22.0",
48-
"babel-runtime": "^6.26.0",
49-
"chai": "^4.1.2",
50-
"chalk": "^2.0.1",
51-
"chromedriver": "^2.27.2",
52-
"connect-history-api-fallback": "^1.3.0",
53-
"copy-webpack-plugin": "^4.0.1",
54-
"cross-env": "^5.0.1",
55-
"cross-spawn": "^5.0.1",
56-
"css-loader": "^0.28.0",
57-
"eslint": "^3.19.0",
58-
"eslint-config-standard": "^10.2.1",
59-
"eslint-friendly-formatter": "^3.0.0",
60-
"eslint-loader": "^1.7.1",
61-
"eslint-plugin-html": "^3.0.0",
62-
"eslint-plugin-import": "^2.7.0",
63-
"eslint-plugin-node": "^5.2.0",
64-
"eslint-plugin-promise": "^3.4.0",
65-
"eslint-plugin-standard": "^3.0.1",
66-
"eventsource-polyfill": "^0.9.6",
67-
"express": "^4.14.1",
68-
"extract-text-webpack-plugin": "^3.0.0",
69-
"file-loader": "^1.1.4",
70-
"friendly-errors-webpack-plugin": "^1.6.1",
71-
"html-loader": "^0.5.1",
72-
"html-webpack-plugin": "^2.30.1",
73-
"http-proxy-middleware": "^0.17.3",
74-
"inject-loader": "^3.0.0",
75-
"karma": "^1.4.1",
76-
"karma-coverage": "^1.1.1",
77-
"karma-mocha": "^1.3.0",
78-
"karma-phantomjs-launcher": "^1.0.2",
79-
"karma-phantomjs-shim": "^1.4.0",
80-
"karma-sinon-chai": "^1.3.1",
81-
"karma-sourcemap-loader": "^0.3.7",
82-
"karma-spec-reporter": "0.0.31",
83-
"karma-webpack": "^2.0.2",
84-
"less-loader": "^4.0.5",
85-
"mocha": "^3.2.0",
86-
"nightwatch": "^0.9.12",
87-
"node-gyp": "^3.6.2",
88-
"opn": "^5.1.0",
89-
"optimize-css-assets-webpack-plugin": "^3.2.0",
90-
"ora": "^1.2.0",
91-
"phantomjs-prebuilt": "^2.1.14",
92-
"portfinder": "^1.0.13",
93-
"postcss-loader": "^2.0.8",
94-
"rimraf": "^2.6.0",
95-
"sass-loader": "^6.0.6",
96-
"selenium-server": "^3.0.1",
97-
"semver": "^5.3.0",
98-
"shelljs": "^0.7.6",
99-
"sinon": "^4.0.0",
100-
"sinon-chai": "^2.8.0",
101-
"stylus": "^0.54.5",
102-
"stylus-loader": "^3.0.1",
103-
"ts-loader": "^3.0.5",
104-
"typescript": "^2.5.3",
105-
"typings": "^2.1.1",
106-
"url-loader": "^0.5.8",
107-
"vue-loader": "^13.3.0",
108-
"vue-style-loader": "^3.0.1",
109-
"vue-template-compiler": "^2.5.2",
110-
"vue-ts-loader": "^0.0.3",
111-
"webpack": "^3.6.0",
112-
"webpack-bundle-analyzer": "^2.9.0",
113-
"webpack-dev-middleware": "^1.12.0",
114-
"webpack-hot-middleware": "^2.18.2",
115-
"webpack-merge": "^4.1.0"
116-
},
117-
"engines": {
118-
"node": ">= 4.0.0",
119-
"npm": ">= 3.0.0"
120-
},
121-
"browserslist": [
122-
"> 1%",
123-
"last 2 versions",
124-
"not ie <= 8"
125-
]
126-
}
2+
"name": "vue-demo",
3+
"version": "1.0.0",
4+
"description": "A Vue.js project",
5+
"author": "yangd <[email protected]>",
6+
"private": true,
7+
"scripts": {
8+
"dev": "node build/dev-server.js",
9+
"start": "npm run dev",
10+
"build": "node build/build.js",
11+
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
12+
"e2e": "node test/e2e/runner.js",
13+
"test": "npm run unit && npm run e2e",
14+
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
15+
},
16+
"dependencies": {
17+
"axios": "^0.16.2",
18+
"clipboard": "^1.7.1",
19+
"dexie": "^2.0.1",
20+
"echarts": "^3.7.2",
21+
"iview": "^2.5.1",
22+
"less": "^3.0.0-alpha.3",
23+
"less-loader": "^4.0.5",
24+
"node-sass": "^4.5.3",
25+
"normalize.css": "^7.0.0",
26+
"sass-loader": "^6.0.6",
27+
"ts-loader": "^3.0.5",
28+
"tslib": "^1.8.0",
29+
"typescript": "^2.5.3",
30+
"vue": "^2.5.2",
31+
"vue-class-component": "^6.0.0",
32+
"vue-router": "^3.0.1"
33+
},
34+
"devDependencies": {
35+
"@types/jasmine": "^2.6.0",
36+
"@types/webpack": "^3.0.13",
37+
"@types/webpack-env": "^1.13.2",
38+
"autoprefixer": "^7.1.2",
39+
"awesome-typescript-loader": "^3.2.3",
40+
"babel-core": "^6.22.1",
41+
"babel-eslint": "^7.1.1",
42+
"babel-loader": "^7.1.1",
43+
"babel-plugin-dynamic-import-webpack": "^1.0.1",
44+
"babel-plugin-istanbul": "^4.1.1",
45+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
46+
"babel-plugin-transform-runtime": "^6.22.0",
47+
"babel-preset-env": "^1.3.2",
48+
"babel-preset-stage-2": "^6.22.0",
49+
"babel-register": "^6.22.0",
50+
"babel-runtime": "^6.26.0",
51+
"chai": "^4.1.2",
52+
"chalk": "^2.0.1",
53+
"chromedriver": "^2.27.2",
54+
"connect-history-api-fallback": "^1.3.0",
55+
"copy-webpack-plugin": "^4.0.1",
56+
"cross-env": "^5.0.1",
57+
"cross-spawn": "^5.0.1",
58+
"css-loader": "^0.28.0",
59+
"eslint": "^3.19.0",
60+
"eslint-config-standard": "^10.2.1",
61+
"eslint-friendly-formatter": "^3.0.0",
62+
"eslint-loader": "^1.7.1",
63+
"eslint-plugin-html": "^3.0.0",
64+
"eslint-plugin-import": "^2.7.0",
65+
"eslint-plugin-node": "^5.2.0",
66+
"eslint-plugin-promise": "^3.4.0",
67+
"eslint-plugin-standard": "^3.0.1",
68+
"eventsource-polyfill": "^0.9.6",
69+
"express": "^4.14.1",
70+
"extract-text-webpack-plugin": "^3.0.0",
71+
"file-loader": "^1.1.4",
72+
"friendly-errors-webpack-plugin": "^1.6.1",
73+
"html-loader": "^0.5.1",
74+
"html-webpack-plugin": "^2.30.1",
75+
"http-proxy-middleware": "^0.17.3",
76+
"inject-loader": "^3.0.0",
77+
"karma": "^1.4.1",
78+
"karma-coverage": "^1.1.1",
79+
"karma-mocha": "^1.3.0",
80+
"karma-phantomjs-launcher": "^1.0.2",
81+
"karma-phantomjs-shim": "^1.4.0",
82+
"karma-sinon-chai": "^1.3.1",
83+
"karma-sourcemap-loader": "^0.3.7",
84+
"karma-spec-reporter": "0.0.31",
85+
"karma-webpack": "^2.0.2",
86+
"less-loader": "^4.0.5",
87+
"mocha": "^3.2.0",
88+
"nightwatch": "^0.9.12",
89+
"node-gyp": "^3.6.2",
90+
"opn": "^5.1.0",
91+
"optimize-css-assets-webpack-plugin": "^3.2.0",
92+
"ora": "^1.2.0",
93+
"phantomjs-prebuilt": "^2.1.14",
94+
"portfinder": "^1.0.13",
95+
"postcss-loader": "^2.0.8",
96+
"rimraf": "^2.6.0",
97+
"sass-loader": "^6.0.6",
98+
"selenium-server": "^3.0.1",
99+
"semver": "^5.3.0",
100+
"shelljs": "^0.7.6",
101+
"sinon": "^4.0.0",
102+
"sinon-chai": "^2.8.0",
103+
"stylus": "^0.54.5",
104+
"stylus-loader": "^3.0.1",
105+
"ts-loader": "^3.0.5",
106+
"typescript": "^2.5.3",
107+
"typings": "^2.1.1",
108+
"url-loader": "^0.5.8",
109+
"vue-loader": "^13.3.0",
110+
"vue-style-loader": "^3.0.1",
111+
"vue-template-compiler": "^2.5.2",
112+
"vue-ts-loader": "^0.0.3",
113+
"webpack": "^3.6.0",
114+
"webpack-bundle-analyzer": "^2.9.0",
115+
"webpack-dev-middleware": "^1.12.0",
116+
"webpack-hot-middleware": "^2.18.2",
117+
"webpack-merge": "^4.1.0"
118+
},
119+
"engines": {
120+
"node": ">= 4.0.0",
121+
"npm": ">= 3.0.0"
122+
},
123+
"browserslist": [
124+
"> 1%",
125+
"last 2 versions",
126+
"not ie <= 8"
127+
]
128+
}

src/router/index.ts

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/// <reference path="../../node_modules/@types/webpack-env/index.d.ts" />
2+
23
import Vue from 'vue';
34
import Router, { RouterOptions } from 'vue-router';
4-
import Login from '../components/account/login.ts';
5+
const Login = () => import('../components/account/login');
56

67
Vue.use(Router);
78

@@ -10,15 +11,7 @@ export default new Router({
1011
{
1112
path: '/',
1213
name: 'account_login',
13-
components: {
14-
Login: Login // require('../components/account/login.ts')
15-
// Login: resolve => require(['../components/account/login.ts'], resolve)
16-
// Login: (resolve) => {
17-
// require.ensure([], (require) => {
18-
// const cmp = require('../components/account/login').default;
19-
// resolve(cmp);
20-
// }, 'Login');
21-
}
14+
component: Login
2215
}
2316
]
24-
} as RouterOptions);
17+
} as RouterOptions);

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"outDir": "./types/",
4-
"module": "es2015",
4+
"module": "amd",
55
"target": "es5",
66
"strict": true,
77
"moduleResolution": "node",

types-extend/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)