我正在將React代碼轉換爲打字稿, 目標在tsconfig中是es5。獲取錯誤承諾在IE11中未定義
了在IE上運行11我得到一個錯誤「無極未定義」
我知道我需要填充工具,但如何?
我不使用巴別。
以下是我Webpack.config
var webpack = require("webpack");
var Promise = require('es6-promise').Promise;
var paths = require('./config/paths');
var HtmlWebpackPlugin = require('html-webpack-plugin');
//var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
var AureliaWebpackPlugin = require('aurelia-webpack-plugin');
var publicPath = '/';
var publicUrl = '';
module.exports = {
entry: {
app: [
'core-js/fn/promise',
'./Generated Files/app.js'
],
vendor: paths.vendorPath,
},
output: {
path:__dirname + "/dist",
filename: 'bundle.js',
publicPath: publicPath
},
devtool: '#source-map',
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
module: {
loaders: [
{
test: /.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
loader: 'style-loader!css-loader',
//exclude: /node_modules/,
},
{
test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/,
loader: 'file',
query: {
name: 'static/media/[name].[hash:8].[ext]'
}
},
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
}),
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml,
}),
// For using jQuery
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
'window.jQuery': 'jquery',
'window.$': 'jquery',
}),
new webpack.ProvidePlugin({
"Promise": "promise-polyfill"
}),
// new AureliaWebpackPlugin(),
new webpack.optimize.CommonsChunkPlugin({/* chunkName= */name:"vendor", /* filename= */filename:'static/js/vendor.js'})
]
};
不適用於我...錯誤:無法解析'es6-promise-promise'和如果我只留下Promise:'es6-promise'沒有任何變化,同樣的錯誤... –
var Promise = require('es6-promise')。Promise; 把這個在webpack和 新的webpack.ProvidePlugin({es6-promise-promise,'es6-promise-promise',//按預期工作 }),插件 –
你如何使用provideplugin?你添加這個webpack.config文件? – gdubs