Reputation: 45
I wanted to try out Brunch and am having some trouble getting my compiled JS files to execute in the browser.
The file gets compiled and loaded by the page into the browser. If I stick an alert or a console log in the source files and do a build, then nothing happens when I load the page.
If I edit the file manually and put a console log or an alert into it then it works just fine.
Does anyone have any ideas? I feel like I'm probably just missing something silly.
This is what I have in my brunch config file
exports.paths = {
watched: ['client'],
}
exports.files = {
javascripts: { joinTo: 'javascripts/app.js' },
stylesheets: { joinTo: 'stylesheets/app.css' }
}
exports.plugins = {
sass: {
options: {
includePaths: ['node_modules/foundation-sites/scss']
}
}
}
I have the following brunch plugins in my package.json
"babel-brunch": "^6.1.1",
"clean-css-brunch": "^2.10.0",
"sass-brunch": "^2.10.4",
"uglify-js-brunch": "^2.10.0"
Upvotes: 1
Views: 403
Reputation: 50
are you requiring the build in your html?
see below:
<script src="app.js"></script>
<script>require('initialize')</script>
by default brunch.io registers everything into commonjs modules. It then registers a "initialize" module to bootstrap the app and start everything.
Upvotes: 2