I am now constructing a Typescript webapp by using webpack. Some modules can be imported by being written in webpack.config.js file like below. But how many times I tried, bootstrap module won't be imported into my app.
How should I do ?
here is a part of my webpack.config.js
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('.bower.json', ['main'])
),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery',
_: 'lodash',
Vue: 'vue'
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin()
],
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
}
I finally and fortunately have found an answer.
The answer is to use BowerWebpackplugin
instead of webpack.ResolverPlugin.DirectoryDescriptionFilePlugin
plugins: [
new BowerWebpackPlugin({
modulesDirectories: ['bower_components'],
manifestFiles: ['bower.json', 'package.json'],
includes: [/.*\.js/],
excludes: [/.*\.less/],
searchResolveModulesDirectories: true
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery',
_: 'lodash',
Vue: 'vue'
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin()
],
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.