Skip to content

Commit

Permalink
chore(vue): add vue jsx hot loader
Browse files Browse the repository at this point in the history
  • Loading branch information
u3u committed Jul 28, 2018
1 parent 9b4087b commit c8c4a37
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"prettier-eslint-check": "^1.0.1",
"prettier-eslint-cli": "^4.7.1",
"sass-loader": "^7.0.3",
"vue-jsx-hot-loader": "^1.4.0",
"vue-svg-loader": "^0.5.0",
"vue-template-compiler": "^2.5.16",
"vue-tsx-support": "^2.0.1"
Expand Down
9 changes: 9 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ const path = require('path');
module.exports = {
css: { extract: false },
chainWebpack: (config) => {
if (process.env.NODE_ENV !== 'production') {
config.module
.rule('tsx')
.test(/\.tsx$/)
.use('vue-jsx-hot-loader')
.before('babel-loader')
.loader('vue-jsx-hot-loader');
}

// https://github.com/mozilla-neutrino/webpack-chain#config-output-shorthand-methods
config.output
.libraryExport('default'); // prettier-ignore
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6765,7 +6765,7 @@ send@0.16.2:
range-parser "~1.2.0"
statuses "~1.4.0"

serialize-javascript@^1.4.0:
serialize-javascript@^1.4.0, serialize-javascript@^1.5.0:
version "1.5.0"
resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz#1aa336162c88a890ddad5384baebc93a655161fe"

Expand Down Expand Up @@ -7753,6 +7753,14 @@ vue-hot-reload-api@^2.3.0:
version "2.3.0"
resolved "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz#97976142405d13d8efae154749e88c4e358cf926"

vue-jsx-hot-loader@^1.4.0:
version "1.4.0"
resolved "http://registry.npm.taobao.org/vue-jsx-hot-loader/download/vue-jsx-hot-loader-1.4.0.tgz#38014b6cac81bdc290f16ca1f4e0e68306542bd8"
dependencies:
hash-sum "^1.0.2"
lodash "^4.17.10"
serialize-javascript "^1.5.0"

vue-loader@^15.2.4:
version "15.2.6"
resolved "https://registry.npmjs.org/vue-loader/-/vue-loader-15.2.6.tgz#4ad4e56a0ca1fd89ebc4220f9e3bd4723097b397"
Expand Down

0 comments on commit c8c4a37

Please sign in to comment.