Skip to content

Commit f54a63e

Browse files
andersktimabbott
authored andcommitted
webpack: Transpile JS code with Babel.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent ecfb7c6 commit f54a63e

File tree

8 files changed

+848
-28
lines changed

8 files changed

+848
-28
lines changed

.babelrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"corejs": 3,
7+
"useBuiltIns": "usage"
8+
}
9+
],
10+
"@babel/typescript"
11+
],
12+
"plugins": [
13+
"@babel/proposal-class-properties"
14+
],
15+
"sourceType": "unambiguous"
16+
}

.browserslistrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
> 0.2%
2+
> 0.2% in US
3+
last 2 versions
4+
Firefox ESR
5+
not dead
6+
Chrome 26 # similar to PhantomJS

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
"description": "",
66
"main": "",
77
"dependencies": {
8+
"@babel/core": "^7.5.5",
9+
"@babel/plugin-proposal-class-properties": "^7.5.5",
10+
"@babel/preset-env": "^7.5.5",
11+
"@babel/preset-typescript": "^7.3.3",
812
"@types/node": "12.0.7",
913
"@types/underscore": "1.8.18",
1014
"@types/webpack": "4.4.32",
1115
"@types/webpack-dev-server": "3.1.6",
1216
"autosize": "4.0.2",
17+
"babel-loader": "^8.0.6",
1318
"blueimp-md5": "2.10.0",
1419
"cache-loader": "4.0.0",
1520
"clipboard": "2.0.4",
@@ -47,7 +52,6 @@
4752
"spectrum-colorpicker": "^1.8.0",
4853
"style-loader": "0.23.1",
4954
"to-markdown": "3.1.0",
50-
"ts-loader": "6.0.2",
5155
"ts-node": "7.0.1",
5256
"typescript": "3.5.1",
5357
"underscore": "1.9.1",

static/js/bundles/app.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import "xdate/src/xdate.js";
1313
import "jquery-validation/dist/jquery.validate.js";
1414
import "blueimp-md5/js/md5.js";
1515
import "clipboard/dist/clipboard.js";
16-
import "core-js/features/string/code-point-at";
1716
import "winchan/winchan.js";
1817
import "handlebars/dist/cjs/handlebars.runtime.js";
1918
import "to-markdown/dist/to-markdown.js";

static/js/bundles/common.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import "core-js/features/promise";
2-
import "core-js/features/string/ends-with";
3-
import "core-js/features/string/starts-with";
4-
import "core-js/features/string/code-point-at";
52
import "jquery/dist/jquery.js";
63
import "underscore/underscore.js";
74
import "../csrf.js";

tools/webpack.config.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ export default (env?: string): webpack.Configuration[] => {
3333
},
3434
],
3535
},
36-
// Run the typescript compilier on .ts files before webpack
36+
// Transpile .js and .ts files with Babel
3737
{
38-
test: /\.tsx?$/,
39-
loader: 'ts-loader',
40-
options: {
41-
configFile: require.resolve('../static/js/tsconfig.json'),
42-
},
38+
test: /\.(js|ts)$/,
39+
include: resolve(__dirname, '../static/js'),
40+
loader: 'babel-loader',
4341
},
4442
// Uses script-loader on minified files so we don't change global variables in them.
4543
// Also has the effect of making processing these files fast
@@ -156,7 +154,7 @@ export default (env?: string): webpack.Configuration[] => {
156154
{ path: "sortablejs/Sortable.js"},
157155
{ path: "winchan/winchan.js", name: 'WinChan'},
158156
];
159-
config.module.rules.push(...getExposeLoaders(exposeOptions));
157+
config.module.rules.unshift(...getExposeLoaders(exposeOptions));
160158

161159
if (production) {
162160
config.plugins = [

version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
# historical commits sharing the same major version, in which case a
2727
# minor version bump suffices.
2828

29-
PROVISION_VERSION = '42.1'
29+
PROVISION_VERSION = '43.0'

0 commit comments

Comments
 (0)