saint
Hello,
I am using React on the Front-end, every time i made the changes it does not automatically build. I always type build brunch on the assets folder.
this is my brunch.config.js
exports.config = {
// See Brunch - ultra-fast HTML5 build tool for docs.
files: {
javascripts: {
joinTo: “js/app.js”
// To use a separate vendor.js bundle, specify two files path // http://brunch.io/docs/config#-files- // joinTo: { // "js/app.js": /^js/, // "js/vendor.js": /^(?!js)/ // } // // To change the order of concatenation of files, explicitly mention here // order: { // before: [ // "vendor/js/jquery-2.1.1.js", // "vendor/js/bootstrap.min.js" // ] // } }, stylesheets: { joinTo: "css/app.css" }, templates: { joinTo: "js/app.js" }},
conventions: {
// This option sets where we should place non-css and non-js assets in.
// By default, we set this to “/assets/static”. Files in this directory
// will be copied topaths.public, which is “priv/static” by default.
assets: /^(static)/
},
// Phoenix paths configuration
paths: {
// Dependencies and current project directories to watch
watched: [“static”, “css”, “js”, “vendor”],
// Where to compile files to
public: “../priv/static”
},
// Configure your plugins
plugins: {
babel: {
presets: [“es2015”, “react”],
// Do not use ES6 compiler in vendor code
ignore: [/web/static/vendor/]
}
},
modules: {
autoRequire: {
“js/app.js”: [“js/app”]
}
},
npm: {
enabled: true,
whitelist: [“phoenix”, “phoenix_html”, “react”, “react-dom”]
}
};
Package.json
{
“repository”: {},
“license”: “MIT”,
“scripts”: {
“deploy”: “brunch build --production”,
“watch”: “brunch watch --stdin”
},
“dependencies”: {
“axios”: “^0.17.0”,
“babel-preset-react”: “^6.24.1”,
“phoenix”: “file:../deps/phoenix”,
“phoenix_html”: “file:../deps/phoenix_html”,
“react”: “^16.0.0”,
“react-dom”: “^16.0.0”,
“react-router-dom”: “^4.2.2”
},
“devDependencies”: {
“babel-brunch”: “6.1.1”,
“brunch”: “2.10.9”,
“clean-css-brunch”: “2.10.0”,
“uglify-js-brunch”: “2.10.0”
}
}
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
idi527
Does it work if you type
npm run watch? Can you show yourconfig/dev.exs?saint
Hello Sir, actually sometimes it automatically update the page, but after a few changes it stop updating the web page.
use Mix.Config
peerreynders
Is it possible that is only what you think is happening? In
brunch-config.js:This is watching for modifications to the files under
assets/static,assets/css,assets/js,assets/vendor. So nothing will happen if you make modifications to files that are not under those folders.http://brunch.io/docs/config#-paths-
Now
app.jsis inassets/jsbut:This is still the default configuration - it specifies the file the JS bundle is based on but it hasn’t been customized to “join other files to it” as is being alluded to in the comments. So Brunch can only go by the
imports andrequires insideapp.jsto determine when the bundle needs to be rebuilt (as far as I understand it) - soapp.jsis only going to be rebuilt (and reloaded) when those known dependencies are modified.http://brunch.io/docs/config#-files-
http://brunch.io/docs/config#pattern-matching
Now what triggers the live reload is that Brunch updates
priv/static/js/app.jsin response to the JS bundle being rebuilt. So if are updating JS files underassetsthat don’t trigger a bundle rebuild, no reload will happen.Reloads only happen when files matching the configured patterns are updated:
saint
thanks peerreynders