Skip to content

Commit

Permalink
fix: uepr-38: fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
KManolov3 committed Nov 1, 2024
1 parent f2adf68 commit f561493
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/components/gui/gui.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {connect} from 'react-redux';
import MediaQuery from 'react-responsive';
import {Tab, Tabs, TabList, TabPanel} from 'react-tabs';
import tabStyles from 'react-tabs/style/react-tabs.css';
import VM from '@scratch/scratch-vm';
import Renderer from '@scratch/scratch-render';
import VM from 'scratch-vm';
import Renderer from 'scratch-render';

import Blocks from '../../containers/blocks.jsx';
import CostumeTab from '../../containers/costume-tab.jsx';
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu-bar/menu-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import bindAll from 'lodash.bindall';
import bowser from 'bowser';
import React from 'react';

import VM from '@scratch/scratch-vm';
import VM from 'scratch-vm';

import Box from '../box/box.jsx';
import Button from '../button/button.jsx';
Expand Down
2 changes: 1 addition & 1 deletion src/containers/gui.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import {compose} from 'redux';
import {connect} from 'react-redux';
import ReactModal from 'react-modal';
import VM from '@scratch/scratch-vm';
import VM from 'scratch-vm';
import {injectIntl, intlShape} from 'react-intl';

import ErrorBoundaryHOC from '../lib/error-boundary-hoc.jsx';
Expand Down
36 changes: 7 additions & 29 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const baseConfig = new ScratchWebpackConfigBuilder(
{
rootPath: path.resolve(__dirname),
enableReact: true,
enableTs: true,
shouldSplitChunks: false
})
.setTarget('browserslist')
Expand All @@ -35,10 +34,7 @@ const baseConfig = new ScratchWebpackConfigBuilder(
library: {
name: 'GUI',
type: 'umd2'
},
// Do not clean the JS files before building as we have two outputs to the same
// dist directory (the regular and the standalone version)
clean: false
}
},
resolve: {
fallback: {
Expand All @@ -61,11 +57,11 @@ const baseConfig = new ScratchWebpackConfigBuilder(
.addPlugin(new CopyWebpackPlugin({
patterns: [
{
from: '../../node_modules/scratch-blocks/media',
from: 'node_modules/scratch-blocks/media',
to: 'static/blocks-media/default'
},
{
from: '../../node_modules/scratch-blocks/media',
from: 'node_modules/scratch-blocks/media',
to: 'static/blocks-media/high-contrast'
},
{
Expand All @@ -76,7 +72,7 @@ const baseConfig = new ScratchWebpackConfigBuilder(
force: true
},
{
context: '../../node_modules/@scratch/scratch-vm/dist/web',
context: 'node_modules/scratch-vm/dist/web',
from: 'extension-worker.{js,js.map}',
noErrorOnMissing: true
}
Expand All @@ -91,13 +87,12 @@ if (!process.env.CI) {
const distConfig = baseConfig.clone()
.merge({
entry: {
'scratch-gui': path.join(__dirname, 'src/index.ts')
'scratch-gui': path.join(__dirname, 'src/index.js')
},
output: {
path: path.resolve(__dirname, 'dist')
}
})
.addExternals(['react', 'react-dom', 'redux', 'react-redux'])
.addPlugin(
new CopyWebpackPlugin({
patterns: [
Expand All @@ -110,17 +105,6 @@ const distConfig = baseConfig.clone()
})
);

// build the shipping library in `dist/` bundled with react, react-dom, redux, etc.
const distStandaloneConfig = baseConfig.clone()
.merge({
entry: {
'scratch-gui-standalone': path.join(__dirname, 'src/index-standalone.tsx')
},
output: {
path: path.resolve(__dirname, 'dist')
}
});

// build the examples and debugging tools in `build/`
const buildConfig = baseConfig.clone()
.enableDevServer(process.env.PORT || 8601)
Expand All @@ -132,13 +116,7 @@ const buildConfig = baseConfig.clone()
player: './src/playground/player.jsx'
},
output: {
path: path.resolve(__dirname, 'build'),

// This output is loaded using a file:// scheme from the local file system.
// Having `publicPath: '/'` (the default) means the `gui.js` file in `build/index.html`
// would be looked for at the root of the filesystem, which is incorrect.
// Hence, we're resetting the public path to be relative.
publicPath: ''
path: path.resolve(__dirname, 'build')
}
})
.addPlugin(new HtmlWebpackPlugin({
Expand Down Expand Up @@ -189,5 +167,5 @@ const buildConfig = baseConfig.clone()
const buildDist = process.env.NODE_ENV === 'production' || process.env.BUILD_MODE === 'dist';

module.exports = buildDist ?
[buildConfig.get(), distStandaloneConfig.get(), distConfig.get()] :
[buildConfig.get(), distConfig.get()] :
buildConfig.get();

0 comments on commit f561493

Please sign in to comment.