We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
方案一 Expose jQuery to real Window object with Webpack
使用expose-loader loaders: [ { test: require.resolve('jquery'), loader: 'expose?jQuery!expose?$' } ]
方案二
window.$ = window.JQuery = JQuery; 入口的js,手工挂载
方案三
plugins: [ new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery" }) ]
把jquery挂载到window能解决很多问题
plugins: [ new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"common", /* filename= */"common.js") ]
Using Handlebars with webpack warning require.extentions not supported
{ resolve: { modulesDirectories: ['node_modules', 'src'], fallback: path.join(__dirname, 'node_modules'), alias: { 'handlebars': 'handlebars/runtime.js' } }, resolveLoader: { fallback: path.join(__dirname, 'node_modules'), alias: { 'hbs': 'handlebars-loader' } } }
entry: [ 'webpack-dev-server/client?http://localhost:8080', 'webpack/hot/dev-server', './src/buy/js/index.js' ], plugins: [new webpack.HotModuleReplacementPlugin()]
如果报 this seems to be a pre-built javascript file 的错误,可以使用noParse处理
this seems to be a pre-built javascript file
resolve: { extensions: ["",".js",".jsx",".es6"], modulesDirectories: ['node_modules', 'src'], fallback: path.join(__dirname, 'node_modules'), alias: { 'jquery': 'jquery/dist/jquery.min.js', 'redux': 'redux/dist/redux.min.js', 'react': 'react/dist/react.min.js', 'react-dom': 'react-dom/dist/react-dom.min.js', 'react-redux': 'react-redux/dist/react-redux.min.js' } }, module: { noParse: [path.resolve(__dirname, './node_modules/react/dist/react.min.js')], loaders: [{ test: /\.jsx?$/, exclude: /(node_modules|bower_components)/, loaders: ['babel?presets[]=react,presets[]=es2015'], }] }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
讨论的问题包括
1.依赖挂载到全局,如jquery
方案一
Expose jQuery to real Window object with Webpack
方案二
方案三
2.jquery plugin引入
把jquery挂载到window能解决很多问题
3.如何打共有包
4.handlebar如何引入
Using Handlebars with webpack warning require.extentions not supported
5.hmr + webpack-dev-server 如何做依赖环境 webpack-hugin-demo
6.alias引入组件报错
如果报
this seems to be a pre-built javascript file
的错误,可以使用noParse处理The text was updated successfully, but these errors were encountered: