amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.57k stars 204 forks source link

Javascript: can't resolve "amber" #1312

Closed sgaxr closed 1 year ago

sgaxr commented 1 year ago

Description

With a new project, you are unable to build the front end assets because of the import Amber from 'amber'; line in src/assets/javascripts/main.js.

Steps to Reproduce

$ amber new my_project
$ cd my_project
$ npm install
$ npm run watch # or npm run release

This will result in:

ERROR in ./src/assets/javascripts/main.js 2:0-26
Module not found: Error: Can't resolve 'amber' in '/path/to/project/src/assets/javascripts'
 @ ./config/webpack/entry.js 9:0-46

webpack compiled with 1 error

Expected behavior: You are able to use javascript out of the box.

Actual behavior: Error building javascript.

Reproduces how often: 100%

Versions

$ amber --version
Amber CLI (amberframework.org) - v1.2.2

$ crystal --version
Crystal 1.7.2 [29f9ac503] (2023-01-23)

LLVM: 13.0.1
Default target: x86_64-unknown-linux-gnu

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:    22.04
Codename:   jammy

$ node --version
v18.15.0

$ npm --version
9.5.0

Additional Information

I don't think it's relevant, but I was unable to get node-sass installed on my system, so I had to replace it with dart sass (sass).

crimson-knight commented 1 year ago

This issue should be fixed in the latest 1.3.2 release. Please upgrade Amber and try again.

sgaxr commented 1 year ago

It looks like https://github.com/amberframework/amber/archive/stable.tar.gz is still pointing to the 1.2.2 release, but I cloned the repo and was able to build and install from there.

It looks like this issue is indeed resolved here. Thanks!

crimson-knight commented 1 year ago

I made a recent update to bring the v1.3.2 changes onto the stable branch in #1313

Anyone installing on Linux following the setup instructions will now get the last stable version of Amber.