Skip to content

Instantly share code, notes, and snippets.

@ajaybeniwal
Last active June 3, 2020 16:31
Show Gist options
  • Save ajaybeniwal/c8fed8b789450dec33f2058e7ae3130c to your computer and use it in GitHub Desktop.
Save ajaybeniwal/c8fed8b789450dec33f2058e7ae3130c to your computer and use it in GitHub Desktop.
/* eslint-disable no-undef */
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
module.exports = {
entry: path.resolve(process.cwd(), `src/test-spa.js`),
output: {
path: path.resolve(process.cwd(), 'dist'),
libraryTarget: 'system',
filename: 'bundle.js',
jsonpFunction: `webpackJsonp_smarthands`,
},
module: {
rules: [
{
parser: {
system: false,
},
},
{
test: /\.(js|jsx)$/,
exclude: [/node_modules/],
use: ['babel-loader'],
},
{
test: /\.css$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'less-loader', // compiles Sass to CSS, using Node Sass by default
],
},
{
test: /\.less$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'less-loader',
options: {
lessOptions: {
modifyVars: {
'font-family': 'proxima_novaregular',
},
javascriptEnabled: true,
},
},
},
],
},
{
test: /\.(jpg|jpeg|png|gif|mp3|svg|eot|ttf|woff|woff2)$/,
use: {
loader: 'file-loader',
},
},
{
test: /\.(mp4|webm)$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
},
},
},
],
},
externals: ['single-spa', 'react', 'react-dom', /^@ecp\/.*/],
plugins: [new CleanWebpackPlugin()],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment