mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2025-06-28 13:40:22 -04:00
during webpack, find modules using require.resolve
This means the module will be found whether linked (as with `npm link`) or not.
This commit is contained in:
parent
d3fddbe317
commit
34db5ceaac
1 changed files with 5 additions and 3 deletions
|
@ -4,6 +4,8 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
|
||||||
const makeConfig = require('./webpack.makeConfig.js');
|
const makeConfig = require('./webpack.makeConfig.js');
|
||||||
|
|
||||||
|
const getModulePath = moduleName => path.dirname(require.resolve(`${moduleName}/package.json`));
|
||||||
|
|
||||||
module.exports = defaultConfig =>
|
module.exports = defaultConfig =>
|
||||||
makeConfig(
|
makeConfig(
|
||||||
defaultConfig,
|
defaultConfig,
|
||||||
|
@ -19,15 +21,15 @@ module.exports = defaultConfig =>
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
new CopyWebpackPlugin([{
|
new CopyWebpackPlugin([{
|
||||||
from: 'node_modules/scratch-gui/node_modules/scratch-blocks/media',
|
from: path.join(getModulePath('scratch-blocks'), 'media'),
|
||||||
to: 'static/blocks-media'
|
to: 'static/blocks-media'
|
||||||
}]),
|
}]),
|
||||||
new CopyWebpackPlugin([{
|
new CopyWebpackPlugin([{
|
||||||
from: 'extension-worker.{js,js.map}',
|
from: 'extension-worker.{js,js.map}',
|
||||||
context: 'node_modules/scratch-vm/dist/web'
|
context: path.join(getModulePath('scratch-vm'), 'dist', 'web')
|
||||||
}]),
|
}]),
|
||||||
new CopyWebpackPlugin([{
|
new CopyWebpackPlugin([{
|
||||||
from: 'node_modules/scratch-gui/src/lib/libraries/*.json',
|
from: path.join(getModulePath('scratch-gui'), 'src', 'lib', 'libraries', '*.json'),
|
||||||
to: 'static/libraries',
|
to: 'static/libraries',
|
||||||
flatten: true
|
flatten: true
|
||||||
}])
|
}])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue