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

feat: migrate to module #52

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// import typescript from 'rollup-plugin-typescript';
import typescript from 'rollup-plugin-typescript2';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import packageConfig from './package.json'
import packageConfig from './package.json' with {type: 'json'};

const LOCAL_URL = process.env.LOCAL_URL ?? 'http://localhost:4000/';
const PUBLIC_URL = process.env.PUBLIC_URL ?? packageConfig.homepage;
Expand Down
29 changes: 12 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"version": "0.1.0",
"private": true,
"homepage": "https://ochafik.com/openscad2/",
"type": "module",
"engines": {
"node": ">=18.12.0"
},
"dependencies": {
"@monaco-editor/loader": "^1.3.2",
"@monaco-editor/react": "^4.4.6",
Expand All @@ -24,9 +28,9 @@
"react-widgets": "^5.8.4"
},
"scripts": {
"start": "concurrently 'npx webpack serve --mode=development' 'NODE_ENV=development npx rollup --config openscad-worker.rollup.config.js --watch'",
"start": "concurrently 'npx webpack serve --mode=development' 'NODE_ENV=development npx rollup --config openscad-worker.rollup.config.mjs --watch'",
"start:prod": "PUBLIC_URL=http://localhost:3000/dist/ npm run build && npx serve",
"build": "NODE_ENV=production npx rollup --config openscad-worker.rollup.config.js && webpack --mode=production"
"build": "NODE_ENV=production npx rollup --config openscad-worker.rollup.config.mjs && webpack --mode=production"
},
"eslintConfig": {
"extends": [
Expand All @@ -47,26 +51,17 @@
]
},
"devDependencies": {
"@rollup/plugin-html": "^1.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-typescript": "^11.0.0",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-typescript": "^11.1.6",
"@types/filesystem": "^0.0.32",
"@types/node": "^18.15.6",
"@web/rollup-plugin-html": "^1.11.0",
"concurrently": "^7.6.0",
"copy-webpack-plugin": "^11.0.0",
"concurrently": "^8.2.2",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.8.1",
"livereload": "^0.9.3",
"rollup": "^2.79.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-css": "^1.0.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-typescript2": "^0.34.1",
"rollup-watch": "^3.2.2",
"rollup": "^4.18.1",
"serve": "^14.2.0",
"style-loader": "^3.3.3",
"style-loader": "^4.0.0",
"ts-loader": "^9.4.2",
"tslib": "^2.5.0",
"webpack": "^5.76.3",
Expand Down
20 changes: 13 additions & 7 deletions webpack.config.js → webpack.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const CopyPlugin = require("copy-webpack-plugin");
import CopyPlugin from 'copy-webpack-plugin';
import path, {dirname} from 'path';

const path = require('path');
import {fileURLToPath} from 'url';

module.exports = {
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const config = {
entry: './src/index.tsx',
// devtool: 'inline-source-map',
module: {
Expand Down Expand Up @@ -43,20 +47,22 @@ module.exports = {
plugins: [
new CopyPlugin({
patterns: [
{
{
from: path.resolve(__dirname, 'public'),
toType: 'dir',
},
{
{
from: path.resolve(__dirname, 'node_modules/primeicons/fonts'),
to: path.resolve(__dirname, 'dist/fonts'),
toType: 'dir',
},
{
{
from: path.resolve(__dirname, 'src/wasm/openscad.js'),
from: path.resolve(__dirname, 'src/wasm/openscad.wasm'),
},
],
}),
],
};
};

export default config;