I know this is a year old, however I am facing the same issue (sort of). i have a packaged template built with ES6 and nunjucks, scss etc. I integrated the scss with no problems, however the JS is giving problems. The packaged template has a package.json file which I update the dependencies in Sage9 with yarn. The packed template has a js folder with 2 files custom.js and custom-init.js and then a subfolder named /parts with a bunch (32) of JS files that invoke all the dev dependencies in the node_modles. I have kinda hacked the JS by creating a new folder called JS “scripts/js” and put all the files in there. Of course eslint had a fit so I created an .eslintignore and added that directory.
So now Ive added all the imports to in main.js
// import external dependencies
import 'jquery';
// Import everything from autoload
import './autoload/**/*'
import 'ionicons/dist/index';
import 'flickity/dist/flickity.pkgd';
import 'photoswipe/dist/photoswipe';
import 'object-fit-images/dist/ofi.min';
import 'imagesloaded/imagesloaded.pkgd.min';
import { gsap } from 'gsap/dist/gsap.min';
import { ScrollToPlugin } from 'gsap/dist/ScrollToPlugin.min';
gsap.registerPlugin(ScrollToPlugin);
import 'popper.js/dist/umd/popper.min';
import '@fortawesome/fontawesome-free/js/all.min';
import 'sticky-kit/dist/sticky-kit.min';
import 'jarallax/dist/jarallax.min';
import 'jarallax/dist/jarallax-video.min';
import 'flickity/dist/flickity.pkgd.min';
import 'isotope-layout/dist/isotope.pkgd.min';
import 'photoswipe/dist/photoswipe.min';
import 'jquery-validation/dist/jquery.validate.min';
import 'jquery-form/dist/jquery.form.min';
import 'jquery-datetimepicker/build/jquery.datetimepicker.full.min';
import 'jquery-countdown/dist/jquery.countdown.min';
import 'moment/dist/moment';
import 'moment-timezone/builds/moment-timezone-with-data.min';
import 'hammerjs/hammer.min';
import 'typed.js/lib/typed.min';
import 'social-likes/dist/social-likes.min';
import 'nanoscroller/bin/javascripts/jquery.nanoscroller';
import 'soundmanager2/script/soundmanager2-jsmin';
import 'soundmanager2/script/soundmanager2-nodebug-jsmin';
import 'summernote/dist/summernote-bs4.min';
import 'keymaster/keymaster';
import './js/custom';
import './js/custom-init';
// import local dependencies
import Router from './util/Router';
import common from './routes/common';
import home from './routes/home';
import aboutUs from './routes/about';
/** Populate Router instance with DOM routes */
const routes = new Router({
// All pages
common,
// Home page
home,
// About Us page, note the change from about-us to aboutUs.
aboutUs,
});
// Load Events
jQuery(document).ready(() => routes.loadEvents());
This kinda works however I noticed this line:
// Import everything from autoload
`import './autoload/**/*'`
Here are the devDependencies for the template.
“devDependencies”: {
“@babel/core”: “^7.12.0”,
“@babel/preset-env”: “^7.12.0”,
“@babel/register”: “^7.12.0”,
“babel-loader”: “^8.1.0”,
“browser-sync”: “^2.26.12”,
“del”: “^6.0.0”,
“eslint”: “^7.11.0”,
“eslint-config-airbnb”: “^18.2.0”,
“eslint-plugin-import”: “^2.22.1”,
“eslint-plugin-jsx-a11y”: “^6.3.1”,
“gulp”: “^4.0.2”,
“gulp-autoprefixer”: “^7.0.1”,
“gulp-cdnizer”: “^2.2.0”,
“gulp-changed”: “^4.0.2”,
“gulp-clean-css”: “^4.3.0”,
“gulp-connect-php”: “^1.0.3”,
“gulp-data”: “^1.3.1”,
“gulp-header”: “^2.0.9”,
“gulp-htmltidy”: “^0.2.4”,
“gulp-if”: “^3.0.0”,
“gulp-javascript-obfuscator”: “^1.1.6”,
“gulp-load-plugins”: “^2.0.5”,
“gulp-modify-file”: “^1.0.1”,
“gulp-nunjucks-render”: “^2.2.3”,
“gulp-plumber”: “^1.2.1”,
“gulp-rename”: “^2.0.0”,
“gulp-sass”: “^4.1.0”,
“gulp-sourcemaps”: “^2.6.5”,
“gulp-ssh”: “^0.7.0”,
“gulp-uglify”: “^3.0.2”,
“gulp-vinyl-zip”: “^2.2.1”,
“gulp-watch”: “^5.0.1”,
“husky”: “^4.3.0”,
“merge-stream”: “^2.0.0”,
“npm-run-all”: “^4.1.5”,
“string-template”: “^1.0.0”,
“stylelint”: “^13.7.2”,
“stylelint-config-recommended-scss”: “^4.2.0”,
“stylelint-config-standard”: “^20.0.0”,
“stylelint-order”: “^4.1.0”,
“stylelint-scss”: “^3.18.0”,
“vinyl-named”: “^1.1.0”,
“webpack-stream”: “^6.1.0”
}
At this point in trying to integrate this into Sag9. Any input would be appreciated. Im working in Visual Studio Code.
Thanks.