Skip to content

Commit

Permalink
Enable sourcemaps by default (#50)
Browse files Browse the repository at this point in the history
* Match quoting

* Turn on sourcemaps by default

Since sprockets-rails 3.4.0 now knows how to handle them properly.
  • Loading branch information
dhh authored Nov 15, 2021
1 parent f723619 commit d7b7fd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/install/esbuild/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
run "yarn add esbuild"

say "Add build script"
build_script = "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds"
build_script = "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds"

if (`npx -v`.to_f < 7.1 rescue "Missing")
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
Expand Down
3 changes: 2 additions & 1 deletion lib/install/rollup/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default {
output: {
file: "app/assets/builds/application.js",
format: "es",
inlineDynamicImports: true
inlineDynamicImports: true,
sourcemap: true
},
plugins: [
resolve()
Expand Down
4 changes: 3 additions & 1 deletion lib/install/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const path = require("path")
const webpack = require('webpack')
const webpack = require("webpack")

module.exports = {
mode: "production",
devtool: "source-map",
entry: {
application: "./app/javascript/application.js"
},
output: {
filename: "[name].js",
sourceMapFilename: "[name].js.map",
path: path.resolve(__dirname, "app/assets/builds"),
},
plugins: [
Expand Down

0 comments on commit d7b7fd3

Please sign in to comment.