Skip to content

Instantly share code, notes, and snippets.

@linktohack
Created July 24, 2017 07:54
Show Gist options
  • Save linktohack/00b987d5f7d897d73d518b315ed5334f to your computer and use it in GitHub Desktop.
Save linktohack/00b987d5f7d897d73d518b315ed5334f to your computer and use it in GitHub Desktop.
Beagle
// Webpack
config.resolve = config.resolve || {};
config.resolve.alias = config.resolve.alias || {};
Object.assign(config.resolve.alias, {
jquery: path.join(__dirname, '/client/assets/lib/jquery/jquery.js'),
jqueryGritter: path.join(__dirname, '/client/assets/lib/jquery.gritter/js/jquery.gritter.js'),
perfectScrollbar: path.join(__dirname, '/client/assets/lib/perfect-scrollbar/js/perfect-scrollbar.jquery.min.js'),
beagleJs: path.join(__dirname, '/client/assets/js/main.js'),
testExportJs: path.join(__dirname, '/test-export.js'),
});
config.plugins = config.plugins || [];
config.plugins.push(
new webpack.ProvidePlugin({
jQuery: "jquery",
$: "jquery",
'window.jQuery': "jquery",
'window.$': "jquery",
'App': ["beagleJs", "App"]
}));
config.module = config.module || {};
config.module.noParse = /perfect-scrollbar/;
config.module.rules = config.module.rules || [];
config.module.rules.push({
test: require.resolve(path.join(__dirname, '/test-export.js')),
use: 'exports-loader?a,b'
});
config.module.rules.push({
test: require.resolve(path.join(__dirname, '/client/assets/js/main.js')),
use: 'exports-loader?App=App'
});
console.log('CONFIG', JSON.stringify(config, null, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment