Skip to content

Commit

Permalink
chore(ilc/client): better support for source maps on prod
Browse files Browse the repository at this point in the history
  • Loading branch information
stas-nc committed Apr 10, 2024
1 parent fcac0b5 commit d3b1867
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
8 changes: 6 additions & 2 deletions ilc/build/webpack.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env node */
const fs = require('fs');
const path = require('path');
const { DefinePlugin } = require('webpack');
const { DefinePlugin, SourceMapDevToolPlugin } = require('webpack');
const WrapperPlugin = require('wrapper-webpack-plugin');
const { DuplicateIlcPluginsWebpackPlugin, ResolveIlcDefaultPluginsWebpackPlugin } = require('ilc-plugins-sdk/webpack');

Expand Down Expand Up @@ -55,8 +55,12 @@ module.exports = {
new DefinePlugin({
LEGACY_PLUGINS_DISCOVERY_ENABLED: JSON.stringify(environment.isLegacyPluginsDiscoveryEnabled()),
}),
new SourceMapDevToolPlugin({
append: '\n//# sourceMappingURL=http://localhost:8233/_ilc/[url]',
filename: '[file].map[query]',
}),
],
devtool: 'source-map',
devtool: false,
externals: [],
/**
* Very slow performance on macos with webpack-dev-middleware
Expand Down
4 changes: 1 addition & 3 deletions ilc/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ilc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"cidr-matcher": "^2.1.1",
"config": "^3.3.9",
"cookie": "^0.5.0",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"debug": "^4.3.4",
"deepmerge": "4.3.1",
Expand Down
5 changes: 2 additions & 3 deletions ilc/server/serveStatic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const serveStatic = require('serve-static');
const cors = require('cors');

module.exports = function (isProduction) {
if (isProduction) {
Expand All @@ -14,5 +13,5 @@ module.exports = function (isProduction) {
const webpackConfig = require('../../build/webpack.dev');
const compiler = webpack(webpackConfig);

return [webpackDevMiddleware(compiler), serveStatic('public')];
return [cors({ origin: true }), webpackDevMiddleware(compiler), serveStatic('public')];
};

0 comments on commit d3b1867

Please sign in to comment.