Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@FDiskas
Last active November 3, 2016 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FDiskas/43e2c116069306d7b0aace9ade628675 to your computer and use it in GitHub Desktop.
Save FDiskas/43e2c116069306d7b0aace9ade628675 to your computer and use it in GitHub Desktop.
Reproducible bug. `npm install` works. And `yarn` not works.
{ "presets": [ "es2015" ] }

To reproduce the bug wolow this simple steps

Working version

  1. Run npm install
  2. Then open index.html and check the console.

There should be awaylable function datepicker in object tree under the fn key. And in console should not be any errors.

Not working

  1. Remove node_modules and dist and yarn.lock if exists
  2. Run yarn
  3. Then open index.html and check the console.

There are errors complaining that datepicker function is missing.

In node_modules directory under the bootstrap-datepicker I see only the one difference, that there is installed jquery@3.1.1 as subdependency. Witch is wrong. bootstrap-datepicker package.json file is depends on

"dependencies": {
    "jquery" : ">=1.7.1"
  },

But my package.json is requering jquery@2.2.4 and its covering that required range of versions.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="dist/common.js" charset="utf-8"></script>
<script src="dist/app.bundle.js" charset="utf-8"></script>
</body>
</html>
require('babel-polyfill');
require('jquery');
require('bootstrap-datepicker');
console.dir($);
$('input').datepicker();
{
"name": "unknown",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack",
"postinstall": "npm start"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"bootstrap-datepicker": "^1.6.4",
"jquery": "2.2.4",
"webpack": "^1.13.3"
}
}
var webpack = require('webpack');
module.exports = {
entry: './index.js',
target: 'web',
output: {
path: './dist',
filename: 'app.bundle.js',
},
plugins: [
new webpack.ProvidePlugin({
$ : 'jquery',
jQuery : 'jquery',
'window.jQuery': 'jquery',
'root.jQuery' : 'jquery'
}),
new webpack.optimize.CommonsChunkPlugin('common.js')
],
resolve: {
modulesDirectories: [
'node_modules'
],
alias: {
'flightjs': 'flight',
}
},
module: {
loaders: [{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}]
},
amd: { jQuery: true }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment