This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/application.js */ | |
require("@rails/ujs").start(); | |
require("@rails/activestorage").start(); | |
require("packs/example1"); | |
require("packs/example2"); | |
require("packs/example3"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/example2.js */ | |
// to call example1 var, you need: | |
import example1 from './example1'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/example1.js */ | |
var example1 = function doSomething() { | |
// Your codes here | |
} | |
export default example1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/application.js */ | |
require("@rails/ujs").start(); | |
require("@rails/activestorage").start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/webpack/production.js | |
process.env.NODE_ENV = 'production'; | |
const environment = require('./environment'); | |
module.exports = environment.toWebpackConfig(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/webpack/loaders/erb.js | |
module.exports = { | |
test: /\.erb$/, | |
enforce: 'pre', | |
exclude: /node_modules/, | |
use: [{ | |
loader: 'rails-erb-loader', | |
options: { | |
runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/webpack/loaders/custom_loaders.js | |
module.exports = { | |
test: /\.ya?ml$/, | |
loaders: ['json-loader', 'yaml-loader'] | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "webpacker" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- //= jquery_ujs | |
+ //= require rails-ujs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="/assets/jquery.js"></script> | |
<script src="/assets/jquery_ujs.js"></script> |