sails-hook-shipwright 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +24 -4
- package/package.json +6 -6
- package/sails-hook-shipwright-1.0.2.tgz +0 -0
package/index.js
CHANGED
|
@@ -83,11 +83,20 @@ module.exports = function defineShipwrightHook(sails) {
|
|
|
83
83
|
entry.app = jsFiles
|
|
84
84
|
log.verbose('Bundling %d JS files', jsFiles.length)
|
|
85
85
|
} else if (config.js.entry && !Array.isArray(config.js.entry)) {
|
|
86
|
-
entry.app = path.resolve(appPath, config.js.entry)
|
|
86
|
+
entry.app = [path.resolve(appPath, config.js.entry)]
|
|
87
87
|
log.verbose('Bundling %s', config.js.entry)
|
|
88
88
|
}
|
|
89
89
|
if (config.styles.entry) {
|
|
90
|
-
|
|
90
|
+
const stylesPath = path.resolve(appPath, config.styles.entry)
|
|
91
|
+
if (entry.app) {
|
|
92
|
+
// Bundle CSS with the JS entry so the chunk keeps a JS module map.
|
|
93
|
+
// CSS-only entries produce chunks with no JS modules, which crashes
|
|
94
|
+
// the HMR runtime in jsonp_chunk_loading when it tries to apply
|
|
95
|
+
// updates. The CSS extract plugin still outputs a separate CSS file.
|
|
96
|
+
entry.app.unshift(stylesPath)
|
|
97
|
+
} else {
|
|
98
|
+
entry.styles = stylesPath
|
|
99
|
+
}
|
|
91
100
|
log.verbose('Compiling %s', config.styles.entry)
|
|
92
101
|
}
|
|
93
102
|
|
|
@@ -133,9 +142,20 @@ module.exports = function defineShipwrightHook(sails) {
|
|
|
133
142
|
tools: {
|
|
134
143
|
htmlPlugin: false,
|
|
135
144
|
// Don't process absolute URLs in CSS - they reference static assets served from .tmp/public
|
|
136
|
-
cssLoader: { url: { filter: (url) => !url.startsWith('/') } }
|
|
145
|
+
cssLoader: { url: { filter: (url) => !url.startsWith('/') } },
|
|
146
|
+
rspack: {
|
|
147
|
+
watchOptions: {
|
|
148
|
+
// Only watch assets/ and node_modules/ — ignore top-level data
|
|
149
|
+
// directories (e.g. db/ from sails-disk) so non-source filesystem
|
|
150
|
+
// writes don't trigger rebuilds.
|
|
151
|
+
ignored: /^(?!.*[\\/](assets|node_modules)[\\/])/
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
performance: {
|
|
156
|
+
chunkSplit: { strategy: 'split-by-experience' },
|
|
157
|
+
printFileSize: { diff: true }
|
|
137
158
|
},
|
|
138
|
-
performance: { chunkSplit: { strategy: 'split-by-experience' } },
|
|
139
159
|
server: { port: sails.config.port, strictPort: true, printUrls: false },
|
|
140
160
|
dev: { writeToDisk: (file) => file.includes('manifest.json') }
|
|
141
161
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sails-hook-shipwright",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "The modern asset pipeline for Sails",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"hookName": "shipwright"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@rsbuild/core": "^1.7.
|
|
34
|
+
"@rsbuild/core": "^1.7.3",
|
|
35
35
|
"fast-glob": "^3.3.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@commitlint/cli": "^
|
|
39
|
-
"@commitlint/config-conventional": "^
|
|
38
|
+
"@commitlint/cli": "^20.4.1",
|
|
39
|
+
"@commitlint/config-conventional": "^20.4.1",
|
|
40
40
|
"husky": "^9.1.7",
|
|
41
|
-
"lint-staged": "^16.
|
|
42
|
-
"prettier": "^3.
|
|
41
|
+
"lint-staged": "^16.2.7",
|
|
42
|
+
"prettier": "^3.8.1"
|
|
43
43
|
},
|
|
44
44
|
"lint-staged": {
|
|
45
45
|
"**/*": "prettier --write --ignore-unknown"
|
|
Binary file
|