Qqwy
TypeCheck Core Team
I am building a simple Phoenix application that harnesses Phoenix’ channels, and I want to create two compiled JavaScript files:
- The normal ‘app.js’ that contains all code in
/assets/js/exceptsnippet.js. - A lite ‘snippet.js’ that will only be used on a couple of pages, which is a compiled (because I use ES6 stuff) version of
/assets/js/snippet.js(and it imports some other dependencies using ES6importstatements).
I have been strugglig with the brunch configuration but I was unable to figure this out:
- I attempted to alter the
files: javascripts: joinToandfiles: templates: joinTosections to exclude the file on the normal case, and only include the file forsnippet.js(What is ‘templates’ for exactly, anyway?) - I attempted to add
js/snippettomodules: autoRequirebut this did not help (and I don’t understand what it does exactly).
I did look in the Brunch documentation, but this did not help very much (and it is a lot less detailed than Elixir’s documentation
)
Maybe someone who has done something similar in the past knows what to do?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
yurko
here’s an example snippet from brunch config for two files which use different dependencies:
edit: the
src/indexandadmin/indexmap to source files assets/src/index.js and assets/admin/index.js which import needed modulesQqwy
Thank you for your reply, @yurko!
Do you require to spell out the paths to all your dependencies in your Brunch file’s
joinToas well?yurko
These dependencies are needed as far as I remember for the separation between the compiled files. Try it without them and see if you have a need for more separation.
It’s been some time since I set these things up so I can’t give you exact explanation of what’s what and for what purpose
Qqwy
Yes, you are correct. I indeed get build errors when I try to include a file that is not part of the ‘joinTo’ statement.
Is there a way around this? Currently I need to require all my dependencies, as well as their dependencies (and their dependencies etc…) in there. Of course I can maybe set up my folder structure in a way that keeps the regexp ‘simple-ish’ but it feels very flaky to do it like this.
yurko
Hm, I think you only explicitly list dependencies you want to exclude, in example above this joinTo line
"js/app.js": /(^src\/|^node_modules\/(?!(bootstrap|trumbowyg)))/,means “exclude bootstrap and trumbowyg from node_modules”.Here’s the top part of the index file
assets/src/index.jsmapped in autoRequire"js/app.js": ["src/index"],:as you can see these are mixed imports of own modules and ones installed via npm none of which are listed in joinTo.
Might be something with the way you include it or the way the module you want to import is defined. If it’s an npm dependency from node_modules, check if you have it enabled, something like this
Qqwy
It turns out that there is an alternative to
joinTowhich is calledentryPoints, which will follow allrequires (andimports and other ways of including files), which is exactly what I was looking for.Thank you very much!