-
Edouard CHIN authored
- Fix #54241 - ### Problem The `import` statement generated is incorrect for Rails applications using importmap and a css processor. ### Context Rails applications using `importmap` and having a `package.json`, would get a `channel.js` file generated with a relative path, whereas the correct import statement needs to match the name of the importmap json keys. This is because the generator assumes that if a `package.json` exists in the project, this means it uses a javascript bundling tool. This assumption is not correct as one can be using importmap while still having `package.json` for processing css. This is the case when you generate your application like this: `rails new blorgh --css postcss` ### Solution Add the right import statement by checking if the project uses importmap.
Edouard CHIN authored- Fix #54241 - ### Problem The `import` statement generated is incorrect for Rails applications using importmap and a css processor. ### Context Rails applications using `importmap` and having a `package.json`, would get a `channel.js` file generated with a relative path, whereas the correct import statement needs to match the name of the importmap json keys. This is because the generator assumes that if a `package.json` exists in the project, this means it uses a javascript bundling tool. This assumption is not correct as one can be using importmap while still having `package.json` for processing css. This is the case when you generate your application like this: `rails new blorgh --css postcss` ### Solution Add the right import statement by checking if the project uses importmap.
Loading