我正在尝试将我的应用程序从requirejs迁移到webpack 2,但我遇到了麻烦。
我的webpack配置:
let slider: UISlider = {
let slider = UISlider()
slider.isContinuous = true
slider.minimumValue = 1
slider.maximumValue = 3
slider.setMinimumTrackImage(#imageLiteral(resourceName: "minimumSliderTrackImage").resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)), for: .normal)
slider.setMaximumTrackImage(#imageLiteral(resourceName: "maximumSliderTrackImage").resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)), for: .normal)
let sliderThumb = #imageLiteral(resourceName: "sliderThumbImage")
slider.setThumbImage(sliderThumb, for: .normal)
slider.addTarget(self, action: #selector(adjustPriceLabel), for: .valueChanged)
slider.addTarget(self, action: #selector(handleTouchDown), for: .touchDown)
slider.addTarget(self, action: #selector(handleTouchUp), for: [.touchUpInside, .touchUpOutside])
slider.setValue(2.0, animated: true)
return slider
}()
@objc fileprivate func handleTouchDown() {
print(1234)
}
@objc fileprivate func handleTouchUp() {
print(5678)
}
在插件部分:
rules: [
// rules for modules (configure loaders, parser options, etc.)
{
test: /\.jsx?$/,
include: [
path.resolve(__dirname, "src")
],
exclude: [
path.resolve(__dirname, "app/demo-files")
],
enforce: "pre",
enforce: "post",
},
{
test: /underscore/,
loader: 'expose-loader?_'
},
{
test: /howler/,
loader: 'expose-loader?Howl'
},
{
test: /pathfinding/,
loader: 'expose-loader?PF'
},
{
test: /stats/,
loader: 'expose-loader?Stats'
},
{
test: /datgui/,
loader: 'expose-loader?dat.gui'
},
{ test: /jquery/,
loader: 'imports?jQuery=jquery,$=jquery,this=>window'
},
{
test: /jquery-ui/,
use: [
'expose-loader?$',
'imports-loader?this=>window,jquery'
]
}
但是当我这样做时,我有以下错误:
plugins: [
new webpack.ProvidePlugin({
"$":"libs/jquery/jquery.min",
"jQuery":"libs/jquery/jquery.min",
"window.jQuery":"libs/jquery/jquery.min"
}),
]
你可以帮我解决这个问题吗?我认为问题在于导入jquery,但我不知道如何解决这个问题......
由于
答案 0 :(得分:-1)
尝试添加
Popper: ['popper.js', 'default']
至您的插件