Sha256: 0dcf88a607565fb1bba3adbaf0b722f4e6b4c63a804e5e98a45f36bedd71b214
Contents?: true
Size: 1.83 KB
Versions: 5
Compression:
Stored size: 1.83 KB
Contents
/* eslint global-require: 0 */ /* eslint import/no-dynamic-require: 0 */ const webpackMerge = require('webpack-merge') const { resolve } = require('path') const { existsSync } = require('fs') const baseConfig = require('./environments/base') const rules = require('./rules') const config = require('./config') const devServer = require('./dev_server') const env = require('./env') const { moduleExists, canProcess } = require('./utils/helpers') const inliningCss = require('./utils/inliningCss') const globalMutableWebpackConfig = () => { const { nodeEnv } = env const path = resolve(__dirname, 'environments', `${nodeEnv}.js`) const environmentConfig = existsSync(path) ? require(path) : baseConfig return environmentConfig } const generateWebpackConfig = () => { const environmentConfig = globalMutableWebpackConfig() const immutable = webpackMerge.merge({}, environmentConfig) return immutable } const shakapackerObject = { config, // shakapacker.yml devServer, generateWebpackConfig, globalMutableWebpackConfig: globalMutableWebpackConfig(), baseConfig, env, rules, moduleExists, canProcess, inliningCss, ...webpackMerge } // For backward compatibility const shakapackerProxyHandler = { get(target, prop) { if (prop === 'webpackConfig') { // eslint-disable-next-line no-console console.warn(`⚠️ DEPRECATION NOTICE: The 'webpackConfig' is deprecated and will be removed in a future version. Please use 'globalMutableWebpackConfig' instead, or use 'generateWebpackConfig()' to avoid unwanted config mutation across the app. For more information, see version 7 upgrade documentation at: https://github.com/shakacode/shakapacker/blob/master/docs/v7_upgrade.md `) return globalMutableWebpackConfig() } return target[prop] } } module.exports = new Proxy(shakapackerObject, shakapackerProxyHandler)
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
shakapacker-7.0.3 | package/index.js |
shakapacker-7.0.2 | package/index.js |
shakapacker-7.0.1 | package/index.js |
shakapacker-7.0.0 | package/index.js |
shakapacker-7.0.0.rc.2 | package/index.js |