Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/local/bin/node
  2. /** @license
  3. * Copyright 2016 - present The Material Motion Authors. All Rights Reserved.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  6. * use this file except in compliance with the License. You may obtain a copy
  7. * of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations
  15. * under the License.
  16. */
  17. const Path = require('path')
  18. const PundleDev = require('pundle-dev')
  19. const server = new PundleDev({
  20. server: {
  21. hmr: true,
  22. port: 8080,
  23. hmrPath: '/dist/bundle_hmr',
  24. bundlePath: '/dist/bundle.js',
  25. sourceRoot: Path.join(__dirname, 'example/as-module/site'),
  26. sourceMapPath: '/dist/bundle.js.map',
  27. error(error) {
  28. console.error(error)
  29. }
  30. },
  31. pundle: {
  32. entry: [require.resolve('./example/as-module/index.js')],
  33. pathType: 'filePath',
  34. rootDirectory: __dirname,
  35. replaceVariables: {
  36. 'process.env.NODE_ENV': 'development',
  37. }
  38. },
  39. watcher: { },
  40. generator: {
  41. wrapper: 'hmr',
  42. sourceMap: true
  43. }
  44. })
  45. server.pundle.loadPlugins([
  46. [
  47. 'typescript-pundle',
  48. {
  49. extensions: ['.js', '.ts', '.tsx'],
  50. config: {
  51. compilerOptions: {
  52. jsx: 'react',
  53. strictNullChecks: true,
  54. }
  55. }
  56. }
  57. ]
  58. ]).then(
  59. () => {
  60. server.pundle.loadLoaders([
  61. {
  62. extensions: ['.js', '.ts', '.tsx'],
  63. loader: require('pundle/lib/loaders/javascript').default
  64. },
  65. ])
  66. return server.activate()
  67. }
  68. ).then(
  69. () => console.log('Dev server is listening')
  70. ).catch(console.error)