抱歉超级新手含糊不清的问题,但我可以吗
import {Component} from 'react'
class MyComponent extends Component { ..
而不是
import * as React from 'react`
class MyComponent extends React.Component { ..
在babel / webpack / typescript / react ish environment?
如果没有,为什么?
我的webpack.config.json看起来像这样。
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader', 'source-map-loader'],
exclude: /node_modules/
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'happypack/loader?id=ts'
},
...
plugins: [
new HappyPack({
id: 'ts',
threads: 2,
loaders: [
{
path: 'ts-loader',
query: { happyPackMode: true }
}
]
}),
...