Skip to content

Commit f2f2b18

Browse files
committed
fix: CoCreate.modules.js refrencing
1 parent 38b8da6 commit f2f2b18

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ignore
22
node_modules
3-
modules.js
3+
CoCreate.modules.js
44
dist
55
.npmrc
66
package-lock.json

CoCreate.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
}
6969
],
7070
modules: {
71-
outputPath: "./modules.js",
71+
outputPath: "./CoCreate.modules.js",
7272
"element-prototype": {
7373
import: "@cocreate/element-prototype"
7474
},

webpack.config.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
const path = require("path");
2+
const webpack = require("webpack"); // <-- ADDED: Required for the Replacement Plugin
23
const CoCreateConfig = require("./CoCreate.config");
34
const {
45
ModuleGenerator,
56
FileUploader,
6-
SymlinkCreator
7+
SymlinkCreator,
8+
UnicodeLoader
79
} = require("@cocreate/webpack");
810

911
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
@@ -18,7 +20,7 @@ module.exports = async (env, argv) => {
1820
},
1921

2022
output: {
21-
path: path.resolve(__dirname, "dist"),
23+
path: path.resolve(__dirname, "./src/dist"),
2224
filename: isProduction ? "[name].js" : "[name].js",
2325
chunkFilename: isProduction ? "[name].js" : "[name].js",
2426
library: "CoCreate", // The name of your library globally
@@ -32,11 +34,22 @@ module.exports = async (env, argv) => {
3234
// Ensure your target environments support it or esbuild can transpile it adequately for your target.
3335
topLevelAwait: true
3436
},
35-
37+
3638
plugins: [
3739
new ModuleGenerator(CoCreateConfig.modules),
3840
new FileUploader(env, argv),
3941
new SymlinkCreator(),
42+
43+
// <-- ADDED: The Surgical Fix for npm link -->
44+
// Forcefully redirects any dynamic import of "CoCreate.config.js"
45+
// to the physical file in your project root, bypassing symlinks.
46+
new webpack.NormalModuleReplacementPlugin(
47+
/CoCreate\.config\.js$/,
48+
function (resource) {
49+
resource.request = path.resolve(__dirname, "./CoCreate.config.js");
50+
}
51+
),
52+
4053
new MiniCssExtractPlugin({
4154
filename: isProduction ? "[name].min.css" : "[name].css",
4255
chunkFilename: (pathData) => {
@@ -128,4 +141,4 @@ module.exports = async (env, argv) => {
128141
};
129142

130143
return config;
131-
};
144+
};

0 commit comments

Comments
 (0)