How to use the @rails/webpacker.environment.loaders function in @rails/webpacker

To help you get started, we’ve selected a few @rails/webpacker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github evrone / normas / examples / normas_on_rails / config / webpack / environment.js View on Github external
// User ES-next source from Normas for development
const babelLoader = environment.loaders.get('babel');
babelLoader.exclude = /node_modules(?!\/normas)/;

// Globalize jQuery
const oldToWebpackConfig = environment.toWebpackConfig;
environment.toWebpackConfig = () => {
  const config = oldToWebpackConfig.call(environment);
  config.resolve.alias = {
    jquery: 'jquery/src/jquery',
  };
  return config;
};

environment.loaders.append('source-map', {
  test: /\.js$/,
  use: ['source-map-loader'],
  enforce: 'pre'
});

module.exports = environment;
github 3scale / porta / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')

// Add global webpack configs here

const babelLoader = environment.loaders.get('babel')
babelLoader.test = /\.jsx?|.spec.js?$/

environment.loaders.delete('css')
environment.loaders.delete('moduleCss')
environment.loaders.delete('sass')
environment.loaders.delete('moduleSass')

environment.loaders.append('null', {
  test: /\.css$/,
  include: stylesheet => stylesheet.indexOf('@patternfly/react-styles/css/') > -1,
  use: ['null-loader']
})

environment.loaders.append('style', {
  test: /(\.css|\.scss|\.sass)$/,
  use: [
    { loader: 'style-loader' },
    { loader: 'css-loader' },
    {
      loader: 'sass-loader',
      options: {
        modules: true,
        localIdentName: '[name]---[local]---[hash:base64:5]'
      }
github restarone / violet_rails / config / webpack / environment.js View on Github external
environment.plugins.append("Provide", new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
Popper: ['popper.js', 'default']
}))

const config = environment.toWebpackConfig();


config.resolve.alias = {
  jquery: 'jquery/src/jquery'
 };
// bootstrap jquery setup


environment.loaders.prepend('erb', erb)
module.exports = environment
github kaspernj / api_maker / spec / dummy / config / webpack / environment.js View on Github external
const { environment } = require("@rails/webpacker")
const path = require("path")
const webpack = require("webpack")

// Fixes issues with resolving linked packages with peer dependencies when developing
environment.config.resolve.modules = [path.resolve("./node_modules")]
// environment.config.resolve.symlinks = false // Enabling this will make webpack-dev-server unable to watch for changes

// For whatever reason suddenly this was required
environment.loaders.append("babel", {
  test: /\.(js|jsx)$/,
    loader: "babel-loader"
  }
)

// Makes it possible to not import these very used components
environment.plugins.append(
  "ProvidePlugin",
  new webpack.ProvidePlugin({
    Account: ["api-maker/models/account", "default"],
    Hash: ["shared/hash", "default"],
    Layout: ["components/layout", "default"],
    Params: ["shared/params", "default"],
    Project: ["api-maker/models/project", "default"],
    PropTypesExact: "prop-types-exact",
    React: "react",
github kaishuu0123 / rebacklogs / config / webpack / environment.js View on Github external
//             chunks: 'initial'
//           }
//         }
//       }
//     }
//   })
// })

environment.plugins.append('Provide', new webpack.ProvidePlugin({
  $: 'jquery',
  jQuery: 'jquery',
  Popper: ['popper.js', 'default']
}))

environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
environment.loaders.prepend('vue', vue)
environment.plugins.append('ContextReplacement',
  new webpack.ContextReplacementPlugin(
    /moment[\/\\]locale$/,
    /ja|en-SG|en-au|en-ca|en-gb|en-ie|en-il|en-nz|de|fr|fu|zh-tw|zh-cn|zh-hk/
  )
)

module.exports = environment
github ChaelCodes / HuntersKeepers / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')
const { VueLoaderPlugin } = require('vue-loader')
const vue = require('./loaders/vue')

environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
environment.loaders.prepend('vue', vue)
module.exports = environment
github 8398a7 / abilitysheet / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')
const erb = require('./loaders/erb')

environment.loaders.prepend('erb', erb)
module.exports = environment
github puzzle / cryptopus / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')
const sass =  require('./loaders/sass')
const less =  require('./loaders/less')

environment.loaders.prepend('sass', sass)
environment.loaders.prepend('less', less)
module.exports = environment
github gbarillot / rails-vue-demo-app / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')
const { VueLoaderPlugin } = require('vue-loader')
const vue = require('./loaders/vue')

environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
environment.loaders.prepend('vue', vue)
module.exports = environment
github biosistemika / scinote-web / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')

environment.loaders.delete('nodeModules');

module.exports = environment