Skip to content

Commit 81f5e49

Browse files
committed
Port to TS
1 parent 8325743 commit 81f5e49

File tree

5 files changed

+60
-13
lines changed

5 files changed

+60
-13
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
"purgecss-webpack-plugin": "^1.1.0",
5353
"style-loader": "^0.21.0",
5454
"tailwindcss": "^0.5.1",
55+
"ts-loader": "^5.3.1",
56+
"typescript": "^3.2.2",
5557
"uglifyjs-webpack-plugin": "^1.2.5",
5658
"vue-devtools": "^3.1.9",
5759
"vue-feather-icons": "^4.7.1",

resources/assets/scripts/helpers/ziggy.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"strict": true,
5+
"moduleResolution": "node",
6+
"module": "es2015"
7+
},
8+
"include": [
9+
"./resources/assets/scripts/**/*"
10+
]
11+
}

webpack.config.js

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
99
const ShellPlugin = require('webpack-shell-plugin');
1010
const PurgeCssPlugin = require('purgecss-webpack-plugin');
1111
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
12+
1213
// Custom PurgeCSS extractor for Tailwind that allows special characters in
1314
// class names.
1415
//
@@ -52,7 +53,7 @@ const productionPlugins = [
5253
{
5354
extractor: TailwindExtractor,
5455
extensions: ['html', 'js', 'php', 'vue'],
55-
}
56+
},
5657
],
5758
}),
5859
new UglifyJsPlugin({
@@ -86,6 +87,14 @@ module.exports = {
8687
test: /\.vue$/,
8788
loader: 'vue-loader',
8889
},
90+
{
91+
test: /\.tsx?$/,
92+
loader: 'ts-loader',
93+
exclude: /node_modules/,
94+
options: {
95+
appendTsSuffixTo: [/\.vue$/],
96+
},
97+
},
8998
{
9099
test: /\.js$/,
91100
include: [
@@ -114,36 +123,43 @@ module.exports = {
114123
plugins: [
115124
require('postcss-import'),
116125
tailwind('./tailwind.js'),
117-
require('postcss-preset-env')({stage: 0}),
126+
require('postcss-preset-env')({ stage: 0 }),
118127
require('precss'),
119128
require('autoprefixer'),
120129
require('cssnano'),
121-
]
130+
],
122131
},
123132
}],
124133
}),
125-
}
126-
]
134+
},
135+
{
136+
test: /\.(png|jpg|gif|svg)$/,
137+
loader: 'file-loader',
138+
options: {
139+
name: '[name].[ext]?[hash]',
140+
},
141+
},
142+
],
127143
},
128144
resolve: {
145+
extensions: ['.ts', '.js', '.vue', '.json'],
129146
alias: {
130-
'vue$': 'vue/dist/vue.esm.js'
147+
'vue$': 'vue/dist/vue.esm.js',
131148
},
132-
extensions: ['.js', '.vue', '.json'],
133149
symlinks: false,
134150
},
135151
plugins: process.env.NODE_ENV === 'production' ? basePlugins.concat(productionPlugins) : basePlugins,
136152
serve: {
137-
content: "./public/",
153+
content: './public/',
138154
dev: {
139-
publicPath: "/assets/",
155+
publicPath: '/assets/',
140156
headers: {
141-
"Access-Control-Allow-Origin": "*",
157+
'Access-Control-Allow-Origin': '*',
142158
},
143159
},
144160
hot: {
145161
hmr: true,
146162
reload: true,
147-
}
148-
}
163+
},
164+
},
149165
};

yarn.lock

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6554,6 +6554,10 @@ semver-diff@^2.0.0:
65546554
version "5.5.0"
65556555
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
65566556

6557+
semver@^5.0.1:
6558+
version "5.6.0"
6559+
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
6560+
65576561
semver@^5.5.1:
65586562
version "5.5.1"
65596563
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477"
@@ -7099,6 +7103,16 @@ trim-right@^1.0.1:
70997103
version "1.0.1"
71007104
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
71017105

7106+
ts-loader@^5.3.1:
7107+
version "5.3.1"
7108+
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-5.3.1.tgz#70614c8ec4354a9c8b89c9f97b2becb7a98a3980"
7109+
dependencies:
7110+
chalk "^2.3.0"
7111+
enhanced-resolve "^4.0.0"
7112+
loader-utils "^1.0.2"
7113+
micromatch "^3.1.4"
7114+
semver "^5.0.1"
7115+
71027116
tslib@^1.9.0:
71037117
version "1.9.2"
71047118
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.2.tgz#8be0cc9a1f6dc7727c38deb16c2ebd1a2892988e"
@@ -7124,6 +7138,10 @@ typedarray@^0.0.6:
71247138
version "0.0.6"
71257139
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
71267140

7141+
typescript@^3.2.2:
7142+
version "3.2.2"
7143+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5"
7144+
71277145
uglify-es@^3.3.4:
71287146
version "3.3.9"
71297147
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"

0 commit comments

Comments
 (0)