0

I have some files app.js

import $ from 'jquery';
// export for others scripts to use
window.$ = window.jQuery = $;
import personnal from './assets/js/personnal';
import {cube,machin} from './assets/js/exporting';


$( document ).ready(function() {
    $("div#testok").css({"border":"5px solid black"});

});

In the app.js file jquery working but in my custom file "personnal.js" jquery is undefined

$( document ).ready(function() {
    console.log($('div#testok'));

});
console.log('loading personnal');

I use yarn,

{
  "name": "yarnes6",
  "version": "1.0.0",
  "main": "app.js",
  "license": "MIT",
  "browserify": {
    "transform": [
      [
        "babelify",
        {
          "presets": [
            "es2015"
          ]
        }
      ]
    ]
  },
  "scripts": {
    "build": "browserify app.js -o dist/bundle.js",
    "watch": "watchify app.js -o dist/bundle.js -v"
  },
  "dependencies": {
    "browserify": "^16.2.3",
    "jquery": "^3.4.1",
    "reading-time": "^1.2.0",
    "watchify": "^3.11.1"
  },
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-preset-es2015": "^6.24.1",
    "babelify": "^8"
  }
}

It's not possible to use jquery directly on my personnal file? what is the method?

tk421
  • 5,775
  • 6
  • 23
  • 34

0 Answers0