Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ilc/client): better support for source maps on prod #587

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 'hidden-source-map',
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')];
};
Loading