Sage9 : Add custom script(independant)

Hi there,

i’m working on a project where i need to add backend JS.

so i’ve created a file “editor.js” (for tinymce) in assets/scripts, and added it in config.json :

{
  "entry": {
"main": [
  "./scripts/main.js",
  "./styles/main.scss"
],
"customizer": [
  "./scripts/customizer.js"
],
"editor":[
  "./scripts/editor.js"
]
  },
  "publicPath": "/app/themes/sage",
  "devUrl": "http://192.168.99.100",
  "proxyUrl": "http://localhost:3000",
  "cacheBusting": "[name]_[hash:8]"
}

so now i have a editor.js in dist/, the problem is that webpack don’t like this JS, if i put my script i get error :

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "build"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! sage@9.0.0-alpha.2 build: `webpack --progress --config assets/build/webpack.config.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the sage@9.0.0-alpha.2 build script 'webpack --progress --config assets/build/webpack.config.js'.
npm ERR! This is most likely a problem with the sage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --progress --config assets/build/webpack.config.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls sage
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\treen\PhpstormProjects\Geeks by Girls\app\themes\sage\npm-debug.log

can you help to understand how to add this script correctly?

PS : this script is for tinymce editor of Wordpress, cand call for tinymce object, my IDE tell me he don’t know this object, do i have to import it ? it’s a dependancy from wordpresss.

thanks a lot

I fixed the end error by adding ESLINT exception to my script
/* eslint no-undef: 0 /
to prevent error on using tinymce object
/
eslint no-alert: 0 */
to prevent error with prompt() function.

maybe a real error message can be helpfull with thise :confused:

by the way, i still use the Sage JS system badly, so somes help on 'how to perfectly load a JS in sage) can be helpfull