I’m using jQuery and Bootstrap in a Phoenix project, but Bootstrap.js complains that jQuery isn’t on the page.
My brunch-config.js is as follows:
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: "js/app.js",
order: {
before: [
"web/static/vendor/js/jquery.js",
"web/static/vendor/js/bootstrap.min.js"
]
}
},
stylesheets: {
joinTo: "css/app.css"
},
templates: {
joinTo: "js/app.js"
}
},
conventions: {
assets: /^(web\/static\/assets)/,
ignored: [
/^(web\/static\/vendor\/bootstrap\/)(?!.*min.(js|css)$)/,
/^(web\/static\/vendor\/jquery\/)(?!.*min.js)/
]
},
// Phoenix paths configuration
paths: {
// Dependencies and current project directories to watch
watched: [
"web/static",
"test/static"
],
// Where to compile files to
public: "priv/static"
},
// Configure your plugins
plugins: {
babel: {
// Do not use ES6 compiler in vendor code
ignore: [/web\/static\/vendor/]
}
},
modules: {
autoRequire: {
"js/app.js": ["web/static/js/app"]
}
},
npm: {
enabled: true,
// Whitelist the npm deps to be pulled in as front-end assets.
// All other deps in package.json will be excluded from the bundle.
whitelist: ["phoenix", "phoenix_html"]
}
};