Skip to content

Commit 58f91da

Browse files
committed
Part 2 - Convert app javascript entry point into Typescript
In this commit we change "app.js" into "app.ts". At this point, this step was as easy changing 1 letter in our webpack.mix.js file! ( mix.js() becomes mix.ts() ) Laravel mix will automatically install any webpack dependency necessary to allow the bundling to work with typescript. After that, we just have to convert the commonJs script into ES2017 Typescript
1 parent 39eeedd commit 58f91da

File tree

5 files changed

+30
-24
lines changed

5 files changed

+30
-24
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"resolve-url-loader": "^2.3.1",
2121
"sass": "^1.15.2",
2222
"sass-loader": "^7.1.0",
23+
"ts-loader": "^5.4.3",
24+
"typescript": "^3.4.5",
2325
"vue": "^2.5.17",
2426
"vue-template-compiler": "^2.6.10"
2527
}

resources/js/app.js

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

resources/js/app.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import './bootstrap';
2+
import Vue from 'vue';
3+
import ExampleComponent from './components/ExampleComponent.vue';
4+
5+
new Vue({
6+
el: '#app',
7+
components: {ExampleComponent},
8+
});

webpack.mix.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
11
const mix = require('laravel-mix');
22

3-
/*
4-
|--------------------------------------------------------------------------
5-
| Mix Asset Management
6-
|--------------------------------------------------------------------------
7-
|
8-
| Mix provides a clean, fluent API for defining some Webpack build steps
9-
| for your Laravel application. By default, we are compiling the Sass
10-
| file for the application as well as bundling up all the JS files.
11-
|
12-
*/
13-
14-
mix.js('resources/js/app.js', 'public/js')
15-
.sass('resources/sass/app.scss', 'public/css');
3+
mix.ts('resources/js/app.ts', 'public/js').sass('resources/sass/app.scss', 'public/css');

yarn.lock

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ chalk@^1.1.3:
14131413
strip-ansi "^3.0.0"
14141414
supports-color "^2.0.0"
14151415

1416-
chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2:
1416+
chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2:
14171417
version "2.4.2"
14181418
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
14191419
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@@ -2278,7 +2278,7 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0:
22782278
dependencies:
22792279
once "^1.4.0"
22802280

2281-
enhanced-resolve@^4.1.0:
2281+
enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0:
22822282
version "4.1.0"
22832283
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f"
22842284
integrity sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==
@@ -5480,7 +5480,7 @@ selfsigned@^1.10.4:
54805480
dependencies:
54815481
node-forge "0.7.5"
54825482

5483-
semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
5483+
semver@^5.0.1, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
54845484
version "5.7.0"
54855485
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
54865486
integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
@@ -6036,6 +6036,17 @@ trim-right@^1.0.1:
60366036
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
60376037
integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=
60386038

6039+
ts-loader@^5.4.3:
6040+
version "5.4.3"
6041+
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-5.4.3.tgz#837f7f397799a665fc1774303c9fd0930d1c5947"
6042+
integrity sha512-pHwZFkZioL7Yi2su0bhW2/djxZ+0iGat1cxlAif4Eg9j5znVYuWGtW0YYY/5w8W+IzLcAlD5KwJDrs5unUKIRA==
6043+
dependencies:
6044+
chalk "^2.3.0"
6045+
enhanced-resolve "^4.0.0"
6046+
loader-utils "^1.0.2"
6047+
micromatch "^3.1.4"
6048+
semver "^5.0.1"
6049+
60396050
tslib@^1.9.0:
60406051
version "1.9.3"
60416052
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
@@ -6059,6 +6070,11 @@ typedarray@^0.0.6:
60596070
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
60606071
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
60616072

6073+
typescript@^3.4.5:
6074+
version "3.4.5"
6075+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99"
6076+
integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==
6077+
60626078
uglify-js@3.4.x:
60636079
version "3.4.10"
60646080
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy