Skip to content

Commit f3becf4

Browse files
Switch from ts-loader to babel to fix HMR issues
1 parent 0a4046d commit f3becf4

File tree

6 files changed

+292
-146
lines changed

6 files changed

+292
-146
lines changed

.babelrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/env",
5+
{
6+
"useBuiltIns": "entry",
7+
"corejs": 3
8+
}
9+
],
10+
"babel-preset-typescript-vue"
11+
],
12+
"plugins": [
13+
[
14+
"@babel/plugin-proposal-decorators",
15+
{
16+
"legacy": true
17+
}
18+
],
19+
[
20+
"@babel/proposal-class-properties",
21+
{
22+
"loose": true
23+
}
24+
]
25+
]
26+
}

assets/js/TestContainer.vue

Lines changed: 0 additions & 15 deletions
This file was deleted.

assets/js/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import TestContainer from './TestContainer.vue';
1+
import Test from './Test.vue';
22
import Vue from 'vue';
33

44
new Vue({
5-
render: (h) => h(TestContainer)
5+
render: (h) => h(Test)
66
}).$mount('#vue');

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"devDependencies": {
3-
"@symfony/webpack-encore": "^0.28.2",
3+
"@babel/core": "^7.11.0",
4+
"@babel/plugin-proposal-decorators": "^7.10.5",
5+
"@babel/preset-env": "^7.11.0",
6+
"@symfony/webpack-encore": "^0.30.0",
47
"@types/webpack-env": "^1.15.1",
8+
"babel-loader": "^8.0.6",
9+
"babel-preset-typescript-vue": "^1.1.1",
510
"core-js": "^3.0.0",
611
"regenerator-runtime": "^0.13.2",
712
"ts-loader": "^5.3.0",

webpack.config.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,13 @@ Encore
4848
.enableVersioning(Encore.isProduction())
4949

5050
// enables @babel/preset-env polyfills
51-
.configureBabelPresetEnv((config) => {
52-
config.useBuiltIns = 'usage';
53-
config.corejs = 3;
54-
})
51+
.configureBabel(null)
5552

5653
// enables Sass/SCSS support
5754
//.enableSassLoader()
5855

5956
// uncomment if you use TypeScript
60-
.enableTypeScriptLoader()
57+
.enableBabelTypeScriptPreset()
6158

6259
.enableVueLoader()
6360

0 commit comments

Comments
 (0)