Skip to content

Commit 8bc4ef3

Browse files
dprokopmarefr
authored andcommitted
Revert "Babel: use babel-loader instead of ts-loader, ng-annotate with babel-plugin-angularjs-annotate (grafana#21554)" (grafana#21570)
This reverts grafana#21554 which caused problems with e2e. This reverts commit e7e0d18.
1 parent c738a88 commit 8bc4ef3

File tree

6 files changed

+254
-538
lines changed

6 files changed

+254
-538
lines changed

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
"url": "http://github.com/grafana/grafana.git"
1010
},
1111
"devDependencies": {
12-
"@babel/core": "7.8.3",
13-
"@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3",
14-
"@babel/plugin-proposal-optional-chaining": "7.8.3",
15-
"@babel/plugin-syntax-dynamic-import": "7.8.3",
12+
"@babel/core": "7.6.4",
13+
"@babel/plugin-syntax-dynamic-import": "7.2.0",
1614
"@babel/preset-env": "7.6.3",
1715
"@babel/preset-react": "7.6.3",
18-
"@babel/preset-typescript": "7.8.3",
16+
"@babel/preset-typescript": "7.6.0",
1917
"@emotion/core": "10.0.10",
2018
"@rtsao/plugin-proposal-class-properties": "7.0.1-patch.1",
2119
"@testing-library/react-hooks": "^3.2.1",
@@ -107,6 +105,8 @@
107105
"mocha": "4.1.0",
108106
"module-alias": "2.2.0",
109107
"monaco-editor": "0.15.6",
108+
"ng-annotate-loader": "0.6.1",
109+
"ng-annotate-webpack-plugin": "0.3.0",
110110
"ngtemplate-loader": "2.0.1",
111111
"node-sass": "4.12.0",
112112
"npm": "6.13.4",

packages/grafana-ui/src/components/Select/Select.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import React, { PureComponent } from 'react';
66
// @ts-ignore
77
import { default as ReactSelect, Creatable } from '@torkelo/react-select';
88
// @ts-ignore
9+
import { Creatable } from '@torkelo/react-select/lib/creatable';
10+
// @ts-ignore
911
import { default as ReactAsyncSelect } from '@torkelo/react-select/lib/Async';
1012
// @ts-ignore
1113
import { components } from '@torkelo/react-select';

scripts/webpack/webpack.dev.js

+32-58
Original file line numberDiff line numberDiff line change
@@ -27,99 +27,73 @@ module.exports = (env = {}) =>
2727
},
2828

2929
module: {
30-
rules: [
30+
rules: [{
31+
test: /\.tsx?$/,
32+
enforce: 'pre',
33+
exclude: /node_modules/,
34+
use: {
35+
loader: 'tslint-loader',
36+
options: {
37+
emitErrors: true,
38+
typeCheck: false,
39+
}
40+
}
41+
},
3142
{
3243
test: /\.tsx?$/,
3344
exclude: /node_modules/,
34-
use: [
35-
{
36-
loader: 'babel-loader',
37-
options: {
38-
cacheDirectory: true,
39-
babelrc: false,
40-
// Note: order is top-to-bottom and/or left-to-right
41-
plugins: [
42-
[
43-
require('@rtsao/plugin-proposal-class-properties'),
44-
{
45-
loose: true,
46-
},
47-
],
48-
'@babel/plugin-proposal-nullish-coalescing-operator',
49-
'@babel/plugin-proposal-optional-chaining',
50-
'@babel/plugin-syntax-dynamic-import', // needed for `() => import()` in routes.ts
51-
'angularjs-annotate',
52-
],
53-
// Note: order is bottom-to-top and/or right-to-left
54-
presets: [
55-
[
56-
'@babel/preset-env',
57-
{
58-
targets: {
59-
browsers: 'last 3 versions',
60-
},
61-
useBuiltIns: 'entry',
62-
modules: false,
63-
},
64-
],
65-
'@babel/preset-typescript',
66-
'@babel/preset-react',
67-
],
68-
},
45+
use: {
46+
loader: 'ts-loader',
47+
options: {
48+
transpileOnly: true
6949
},
70-
{
71-
loader: 'tslint-loader',
72-
options: {
73-
emitErrors: true,
74-
typeCheck: false,
75-
},
76-
},
77-
],
50+
},
7851
},
7952
require('./sass.rule.js')({
8053
sourceMap: false,
81-
preserveUrl: false,
54+
preserveUrl: false
8255
}),
8356
{
8457
test: /\.(png|jpg|gif|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
85-
loader: 'file-loader',
58+
loader: 'file-loader'
8659
},
87-
],
60+
]
8861
},
8962

9063
plugins: [
9164
new CleanWebpackPlugin(),
92-
env.noTsCheck
93-
? new webpack.DefinePlugin({}) // bogus plugin to satisfy webpack API
94-
: new ForkTsCheckerWebpackPlugin({
95-
checkSyntacticErrors: true,
96-
}),
65+
env.noTsCheck ?
66+
new webpack.DefinePlugin({}) // bogus plugin to satisfy webpack API
67+
:
68+
new ForkTsCheckerWebpackPlugin({
69+
checkSyntacticErrors: true,
70+
}),
9771
new MiniCssExtractPlugin({
98-
filename: 'grafana.[name].[hash].css',
72+
filename: 'grafana.[name].[hash].css'
9973
}),
10074
new HtmlWebpackPlugin({
10175
filename: path.resolve(__dirname, '../../public/views/error.html'),
10276
template: path.resolve(__dirname, '../../public/views/error-template.html'),
10377
inject: false,
10478
chunksSortMode: 'none',
105-
excludeChunks: ['dark', 'light'],
79+
excludeChunks: ['dark', 'light']
10680
}),
10781
new HtmlWebpackPlugin({
10882
filename: path.resolve(__dirname, '../../public/views/index.html'),
10983
template: path.resolve(__dirname, '../../public/views/index-template.html'),
11084
inject: false,
11185
chunksSortMode: 'none',
112-
excludeChunks: ['dark', 'light'],
86+
excludeChunks: ['dark', 'light']
11387
}),
11488
new webpack.NamedModulesPlugin(),
11589
new webpack.HotModuleReplacementPlugin(),
11690
new webpack.DefinePlugin({
11791
'process.env': {
118-
NODE_ENV: JSON.stringify('development'),
119-
},
92+
NODE_ENV: JSON.stringify('development')
93+
}
12094
}),
12195
// new BundleAnalyzerPlugin({
12296
// analyzerPort: 8889
12397
// })
124-
],
98+
]
12599
});

scripts/webpack/webpack.hot.js

+35-41
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const webpack = require('webpack');
77
const HtmlWebpackPlugin = require('html-webpack-plugin');
88
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
99
const CleanWebpackPlugin = require('clean-webpack-plugin');
10-
const IgnoreNotFoundExportPlugin = require('./IgnoreNotFoundExportPlugin.js');
10+
const IgnoreNotFoundExportPlugin = require("./IgnoreNotFoundExportPlugin.js");
1111

1212
module.exports = merge(common, {
1313
mode: 'development',
@@ -36,56 +36,50 @@ module.exports = merge(common, {
3636
'!/public/build': 'http://localhost:3000',
3737
},
3838
watchOptions: {
39-
ignored: /node_modules/,
40-
},
39+
ignored: /node_modules/
40+
}
4141
},
4242

4343
optimization: {
4444
removeAvailableModules: false,
4545
runtimeChunk: false,
4646
removeEmptyChunks: false,
47-
splitChunks: false,
47+
splitChunks: false
4848
},
4949

5050
module: {
51-
rules: [
52-
{
51+
rules: [{
5352
test: /\.tsx?$/,
5453
exclude: /node_modules/,
55-
use: [
56-
{
57-
loader: 'babel-loader',
58-
options: {
59-
cacheDirectory: true,
60-
babelrc: false,
61-
plugins: [
62-
[
63-
require('@rtsao/plugin-proposal-class-properties'),
64-
{
65-
loose: true,
54+
use: [{
55+
loader: 'babel-loader',
56+
options: {
57+
cacheDirectory: true,
58+
babelrc: false,
59+
plugins: [
60+
[require('@rtsao/plugin-proposal-class-properties'), {
61+
loose: true
62+
}],
63+
'angularjs-annotate',
64+
'@babel/plugin-syntax-dynamic-import', // needed for `() => import()` in routes.ts
65+
'react-hot-loader/babel',
66+
],
67+
presets: [
68+
[
69+
'@babel/preset-env',
70+
{
71+
targets: {
72+
browsers: 'last 3 versions'
6673
},
67-
],
68-
'angularjs-annotate',
69-
'@babel/plugin-syntax-dynamic-import', // needed for `() => import()` in routes.ts
70-
'react-hot-loader/babel',
74+
useBuiltIns: 'entry',
75+
modules: false
76+
},
7177
],
72-
presets: [
73-
[
74-
'@babel/preset-env',
75-
{
76-
targets: {
77-
browsers: 'last 3 versions',
78-
},
79-
useBuiltIns: 'entry',
80-
modules: false,
81-
},
82-
],
83-
'@babel/preset-typescript',
84-
'@babel/preset-react',
85-
],
86-
},
78+
'@babel/preset-typescript',
79+
'@babel/preset-react',
80+
],
8781
},
88-
],
82+
}, ],
8983
},
9084
{
9185
test: /\.scss$/,
@@ -96,13 +90,13 @@ module.exports = merge(common, {
9690
loader: 'postcss-loader',
9791
options: {
9892
config: {
99-
path: __dirname + '/postcss.config.js',
93+
path: __dirname + '/postcss.config.js'
10094
},
10195
},
10296
},
10397
{
104-
loader: 'sass-loader',
105-
},
98+
loader: 'sass-loader'
99+
}
106100
],
107101
},
108102
{
@@ -119,7 +113,7 @@ module.exports = merge(common, {
119113
template: path.resolve(__dirname, '../../public/views/index-template.html'),
120114
inject: 'body',
121115
alwaysWriteToDisk: true,
122-
chunksSortMode: 'none',
116+
chunksSortMode: 'none'
123117
}),
124118
new HtmlWebpackHarddiskPlugin(),
125119
new webpack.NamedModulesPlugin(),

0 commit comments

Comments
 (0)