Initial commit

Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com>
Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com>
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com>
Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com>
Co-Authored-By: Johan  <4934465+joolsus@users.noreply.github.com>
Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com>
Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
Michael Cartner
2024-01-26 11:52:55 +01:00
commit b9c60b07dc
2789 changed files with 868795 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
module.exports = {
target: 'electron-renderer',
module: {
rules: [
//run babel on .jsx to transform the jsx
//not doing it on all .js files speeds up the bundling by a lot
{
test: /\.(jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
cacheDirectory: true,
presets: ['@babel/preset-react']
}
}
},
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
},
{
// Setup to match what we have in Storybook
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
prettier: false,
svgo: false,
svgoConfig: {
plugins: [
{
removeViewBox: false
}
]
},
titleProp: true,
ref: true
}
},
{
loader: 'file-loader'
}
]
},
//requiring html-files will return a string of the html
{
test: /\.(html)$/,
exclude: /node_modules/,
use: {
loader: 'html-loader',
options: {
sources: false,
esModule: false
}
}
},
{
test: /(\.module)?.(sass|scss)$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
url: false,
modules: {
localIdentName: '[name]__[local]--[hash:base64:5]'
},
sourceMap: true
}
},
'sass-loader'
]
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
url: false
}
}
]
},
{
test: /\.(txt)$/,
exclude: /node_modules/,
use: {
loader: 'raw-loader',
options: {
esModule: false
}
}
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx', '.ttf']
}
};

View File

@@ -0,0 +1,24 @@
const merge = require('webpack-merge').default;
const shared = require('./webpack.shared.js');
const sharedCore = require('./webpack.renderer.core.js');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
module.exports = merge(
sharedCore,
merge(shared, {
entry: {
'./src/editor/index': './src/editor/index.ts',
'./src/frames/viewer-frame/index': './src/frames/viewer-frame/index.js',
},
output: {
filename: '[name].bundle.js',
// https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2'
},
plugins: [
new MonacoWebpackPlugin({
languages: ['typescript', 'javascript', 'css']
})
]
})
);

View File

@@ -0,0 +1,40 @@
const path = require('path');
// NOTE: packagesDir will be resolved to packages by the build system too
const editorDir = path.join(__dirname, '../../');
const packagesDir = path.join(__dirname, '../../../');
console.log('--- Webpack Configuration');
console.log('> Editor path: ', editorDir);
console.log('> Packages path: ', packagesDir);
console.log('---');
const alias = {
'@scss-placeholders': path.join(editorDir, 'src/editor/src/styles/placeholders'),
'@scss-mixins': path.join(editorDir, 'src/editor/src/styles/mixins'),
'@scss-variables': path.join(editorDir, 'src/editor/src/styles/variables'),
'@noodl-core-ui': path.join(packagesDir, 'noodl-core-ui/src'),
'@noodl-hooks': path.join(editorDir, 'src/editor/src/hooks'),
'@noodl-utils': path.join(editorDir, 'src/editor/src/utils'),
'@noodl-models': path.join(editorDir, 'src/editor/src/models'),
'@noodl-constants': path.join(editorDir, 'src/editor/src/constants'),
'@noodl-contexts': path.join(editorDir, 'src/editor/src/contexts'),
'@noodl-types': path.join(editorDir, 'src/editor/src/types'),
'@noodl-views': path.join(editorDir, 'src/editor/src/views'),
'@noodl-store': path.join(editorDir, 'src/editor/src/store')
};
console.log('> alias:');
console.log(JSON.stringify(alias, null, 2));
console.log('---');
module.exports = {
output: {
// https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx', '.ttf'],
alias
}
};