Enabled ERB support for webpacker (#6166) [deploy]
This commit is contained in:
parent
4203b57944
commit
ee9b1f58b9
4 changed files with 38 additions and 22 deletions
|
|
@ -1,34 +1,25 @@
|
|||
// const { environment } = require('@rails/webpacker');
|
||||
// const customConfig = require('./custom');
|
||||
|
||||
// environment.config.set('resolve.extensions', ['.foo', '.bar']);
|
||||
// environment.config.set('output.filename', '[name].js');
|
||||
// environment.config.merge(customConfig);
|
||||
// environment.config.delete('output.chunkFilename');
|
||||
|
||||
// module.exports = environment;
|
||||
|
||||
|
||||
const { environment } = require('@rails/webpacker')
|
||||
const webpack = require('webpack')
|
||||
const { environment } = require('@rails/webpacker');
|
||||
const erb = require('./loaders/erb');
|
||||
const webpack = require('webpack');
|
||||
|
||||
environment.plugins.append(
|
||||
'CommonsChunkVendor',
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks: (module) => {
|
||||
minChunks: module => {
|
||||
// this assumes your vendor imports exist in the node_modules directory
|
||||
return module.context && module.context.indexOf('node_modules') !== -1
|
||||
}
|
||||
})
|
||||
)
|
||||
return module.context && module.context.indexOf('node_modules') !== -1;
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
environment.plugins.append(
|
||||
'CommonsChunkManifest',
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
minChunks: Infinity
|
||||
})
|
||||
)
|
||||
minChunks: Infinity,
|
||||
}),
|
||||
);
|
||||
|
||||
module.exports = environment
|
||||
environment.loaders.append('erb', erb);
|
||||
module.exports = environment;
|
||||
|
|
|
|||
11
config/webpack/loaders/erb.js
Normal file
11
config/webpack/loaders/erb.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
test: /\.erb$/,
|
||||
enforce: 'pre',
|
||||
exclude: /node_modules/,
|
||||
use: [{
|
||||
loader: 'rails-erb-loader',
|
||||
options: {
|
||||
runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
|
@ -109,6 +109,7 @@
|
|||
"preact-textarea-autosize": "^4.0.7",
|
||||
"prop-types": "^15.7.2",
|
||||
"pusher-js": "^5.1.1",
|
||||
"rails-erb-loader": "^5.5.2",
|
||||
"stimulus": "^1.1.1",
|
||||
"twilio-video": "^2.1.0",
|
||||
"web-share-wrapper": "^0.2.1"
|
||||
|
|
|
|||
13
yarn.lock
13
yarn.lock
|
|
@ -7373,6 +7373,11 @@ lodash.debounce@4.0.8, lodash.debounce@^4.0.8:
|
|||
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
|
||||
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
|
||||
|
||||
lodash.defaults@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
|
||||
integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=
|
||||
|
||||
lodash.flattendeep@^4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2"
|
||||
|
|
@ -10086,6 +10091,14 @@ radium@^0.19.0:
|
|||
inline-style-prefixer "^2.0.5"
|
||||
prop-types "^15.5.8"
|
||||
|
||||
rails-erb-loader@^5.5.2:
|
||||
version "5.5.2"
|
||||
resolved "https://registry.yarnpkg.com/rails-erb-loader/-/rails-erb-loader-5.5.2.tgz#db3fa8ac89600f09d179a1a70a2ca18c592576ea"
|
||||
integrity sha512-cjQH9SuSvRPhnWkvjmmAW/S4AFVDfAtYnQO4XpKJ8xpRdZayT73iXoE+IPc3VzN03noZXhVmyvsCvKvHj4LY6w==
|
||||
dependencies:
|
||||
loader-utils "^1.1.0"
|
||||
lodash.defaults "^4.2.0"
|
||||
|
||||
randomatic@^3.0.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue